Skip to main content

Posts

Showing posts with the label rm

GIT: Remove sensitive data

From time to time users accidentally commit data like passwords or keys into a git repo. While you can use   git rm   to remove the file, it will still be in the repo's history. Fortunately, git makes it fairly simple to remove the file from the entire repo history. Change your files This step should be blatantly obvious, but some users still skip it. If you committed a password, change it! If you committed a key, generate a new one. If you commited private files remove them. Once the commit has been pushed you should consider the data to be compromised. Purge the file from your repo Now that the password is changed, you want to remove the file from history and add it to the .gitignore  to ensure it is not accidentally re-committed. For our examples, we're going to remove Rakefile  from the  GitHub gem  repo. $ git clone https://github.com/defunkt/github-gem.git # Initialized empty Git repository in /Users/tekkub/tmp/github-gem/.git/ # remot...