4

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

N. Lowes
  • 61
  • 1
  • 1
  • 2

1 Answers1

5

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
Community
  • 1
  • 1
CodeWizard
  • 128,036
  • 21
  • 144
  • 167