문제

I posted some code in github but accidentally posted some passwords too and I changed them but it still seen in the commit section.

How could I hide that commit?

도움이 되었습니까?

해결책

The only way to purge that diff is with a force push. If multiple people are working on that same branch, you'd best let them know that you're rewriting history.

Assuming it was your last commit...

git reset --soft HEAD~
(undo password changes)
git diff
(make sure there are no changes that display the passwords)
(stage/commit changes)
git push origin +branch_name

Following standard security precautions, I would also reset those passwords if they're linked to sensitive data...

다른 팁

And you can use a private GitHub email address for future commits.

GitHub gives a no-reply email address for every user, something like user-name@users.noreply.github.com.

You can enable it by going to https://github.com/settings/emails and toggling on Keep my email addresses private & Block command line pushes that expose my email.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top