Hiding commit from github
17,128
I had my access token in there
OOPs.
You cant hide commits but you can delete them from history.
You should use this tool:
https://rtyley.github.io/bfg-repo-cleaner/
It the prefect tool for this kind of task
BFG Repo-Cleaner
an alternative to git-filter-branch.
The BFG is a simpler, faster alternative to git-filter-branch for cleansing bad data out of your Git repository history:
- Removing Crazy Big Files
- Removing Passwords, Credentials & other Private data
Examples (from the official site)
In all these examples bfg is an alias for java -jar bfg.jar.
# Delete all files named 'id_rsa' or 'id_dsa' :
bfg --delete-files id_{dsa,rsa} my-repo.git
Related videos on Youtube
Author by
N. Lowes
Updated on June 04, 2022Comments
-
N. Lowes over 1 year
I pushed my code to github not realizing I had my access token in there. Which brings me to two questions
Is there anyway to hide a commit?
Is it really that bad to have your access token there?
Thank yoou
-
toasted_flakes over 7 yearsOnce its pushed it's out there. You can remove it by rewriting history, but there are bots harvesting this automatically. You should invalidate your token.
-
Roland Starke over 7 yearsYour first question already has an answer here: stackoverflow.com/questions/448919/…
-
matbrgz over 7 yearsInvalidate it and create a new one.
-
IceBotYT almost 3 yearsTHANK YOU! This made me breathe a sigh of relief. @CodeWizard
-
IceBotYT almost 3 yearsThere you go! :)