That will amend the previous commit with any new changes you've made, including entire file removals done with a git rm. If you last commit is the one to add the sensitive information, you can simply remove the sensitive information, then run: git commit -a -amend In the future, if you accidentally commit some changes with sensitive information but you notice before pushing to a remote repository, there are some easier fixes. To fix this, they'll have to either delete their existing repository and re-clone it, or follow the instructions under "RECOVERING FROM UPSTREAM REBASE" in the git-rebase manpage. When others try pull down your latest changes after this, they'll get a message indicating that the changes can't be applied because it's not a fast-forward. Keep in mind that once you've pushed this code to a remote repository like GitHub and others have cloned that remote repository, you're now in a situation where you're rewriting history. "git rm -cached -ignore-unmatch PATH-TO-YOUR-FILE-WITH-SENSITIVE-DATA" \ This is the current code from the FAQ: git filter-branch -force -index-filter \ 'git update-index -remove PATH-TO-YOUR-FILE-WITH-SENSITIVE-DATA'. Note for Windows users: use double quotes (") instead of singles in this command GitHub answered exactly that question as an FAQ: With that out of the way, here's how to fix it. The only safe thing you can do is change your password to something else everywhere you've used it. If anyone has cloned that repository before you fix this, they'll have a copy of your passwords on their local machine, and there's no way you can force them to update to your "fixed" version with it gone from history. For all practical purposes, the first thing you should be worried about is CHANGING YOUR PASSWORDS! It's not clear from your question whether your git repository is entirely local or whether you have a remote repository elsewhere yet if it is remote and not secured from others you have a problem.
0 Comments
Leave a Reply. |