Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hiding commit from github

Tags:

git

github

I pushed my code to github not realizing I had my access token in there. Which brings me to two questions

  1. Is there anyway to hide a commit?

  2. Is it really that bad to have your access token there?

Thank yoou

like image 720
N. Lowes Avatar asked Sep 11 '25 03:09

N. Lowes


1 Answers

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
like image 97
CodeWizard Avatar answered Sep 13 '25 17:09

CodeWizard