0

I am using a shared github repository to collaborate on a project. Because i am an idiot, I committed and pushed a script file containing a password which I don't want to share (Yes, i can change the password, but I would like to remove it anyway!).

Is there any way to revert the commits from github's history, remove the password locally and then recommit and push the updated files? I do not want to remove the file completely, and I would rather not lose the commit history on github.

doctorer
  • 1,672
  • 5
  • 27
  • 50
  • See also https://stackoverflow.com/questions/16877530/completely-remove-a-file-from-whole-git-repository, https://stackoverflow.com/questions/2004024/how-to-permanently-delete-a-file-stored-in-git, etc. – larsks Jan 21 '20 at 23:02
  • I disagree that this is a duplicate. I just want to remove one sensitive line from the file, but keep the file. The link is for removing a sensitive file. – doctorer Jan 21 '20 at 23:22
  • @doctorer: each commit stores a full copy of each file, and no commit can ever be changed at all, so you have to remove *all* of those commits *entirely*. Hence the process is the same. – torek Apr 11 '21 at 06:24

0 Answers0