How Can I hide a commit in GITHUB
Asked Answered
E

1

11

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?

Eboni answered 30/1, 2014 at 7:12 Comment(1)
This is a FAQ: help.github.com/articles/remove-sensitive-dataFils
S
6

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...

Sovereign answered 30/1, 2014 at 7:18 Comment(2)
Sorry for reviving a 7 yo post, but any idea on how to do it if it's not the last commit?Merrill
@AlaaM. squashing all commits to the one that shows your credentials, then do what this answer says.Correna

© 2022 - 2024 — McMap. All rights reserved.