0

I mistakenly added some credentials to my code which should not be accessible to anyone.

VishalTheBeast
  • 459
  • 3
  • 9
  • https://help.github.com/articles/removing-sensitive-data-from-a-repository/ – Adinia Aug 03 '17 at 11:48
  • 2
    See the duplicate question. However, be aware that anybody could have already downloaded your credentials already while they were on GitHub. You should expect that there are people running bots to leach credentials as soon as possible there. As such, you should invalidate and renew your credentials and assume that they have been leaked to a wide public. That is the only safe option. – Holger Just Aug 03 '17 at 11:49

1 Answers1

0

You will have to force push to your repository.

Get the SHA of the parent of the bad commit.

git reset --soft <SHA OF PARENT OF BAD COMMIT>

Fix the credentials,

git commit -am <commit message>

Force push to remote,

git push origin master --force
pratZ
  • 3,078
  • 2
  • 20
  • 29