Created
September 24, 2024 10:34
-
-
Save ubuntupunk/9ee38cfe7e21a505985861fc50be8a3a to your computer and use it in GitHub Desktop.
prune accidental key committed to repo
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ mkdir repo_cleanup | |
$ cd repo_cleanup | |
$ git clone https://github.com/YOUR-USERNAME/YOUR-REPOSITORY . | |
$ git filter-branch --force --index-filter \ | |
"git rm --cached --ignore-unmatch key.txt" \ | |
--prune-empty --tag-name-filter cat -- --all | |
$ echo "key.txt" >> .gitignore | |
$ git add .gitignore | |
$ git commit -m "Add key.txt to .gitignore" | |
$ git push origin --force --all | |
$ git push origin --force --tags |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment