{"id":2989,"date":"2024-11-06T10:07:01","date_gmt":"2024-11-06T16:07:01","guid":{"rendered":"https:\/\/lab.rapternet.us\/?p=2989"},"modified":"2024-09-27T21:09:06","modified_gmt":"2024-09-28T02:09:06","slug":"removing-passwords-from-git-repos","status":"publish","type":"post","link":"https:\/\/lab.rapternet.us\/?p=2989","title":{"rendered":"Removing Passwords from Git Repos"},"content":{"rendered":"\n<p>For those who have accidentally committed passwords, api keys, etc to a guy repo, we have a great tool available to take care of it, BFG. BFG will remove those secrets from the entire git repository&#8217;s history, not just the most recent commit.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">bfg --replace-text passwords.txt<br \/><br \/>git reflog expire --expire=now --all &amp;&amp; git gc --prune=now --aggressive<\/pre>\n\n\n\n<p>Passwords.txt is just a line delimited list of passwords. Just don&#8217;t commit this to your repo<\/p>\n\n\n\n<p>The <a href=\"https:\/\/rtyley.github.io\/bfg-repo-cleaner\/\" target=\"_blank\" rel=\"noreferrer noopener\">tool is available here on github<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>For those who have accidentally committed passwords, api keys, etc to a guy repo, we have a great tool available to take care of it, BFG. BFG will remove those secrets from the entire git repository&#8217;s history, not just the most recent commit. bfg &#8211;replace-text passwords.txtgit reflog expire &#8211;expire=now &#8211;all &amp;&amp; git gc &#8211;prune=now &#8211;aggressive &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/lab.rapternet.us\/?p=2989\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Removing Passwords from Git Repos&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[16,94,14,91,93],"class_list":["post-2989","post","type-post","status-publish","format-standard","hentry","category-how-to","tag-development","tag-git","tag-quick-bites","tag-software","tag-tools"],"_links":{"self":[{"href":"https:\/\/lab.rapternet.us\/index.php?rest_route=\/wp\/v2\/posts\/2989","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lab.rapternet.us\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lab.rapternet.us\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lab.rapternet.us\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lab.rapternet.us\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2989"}],"version-history":[{"count":7,"href":"https:\/\/lab.rapternet.us\/index.php?rest_route=\/wp\/v2\/posts\/2989\/revisions"}],"predecessor-version":[{"id":4106,"href":"https:\/\/lab.rapternet.us\/index.php?rest_route=\/wp\/v2\/posts\/2989\/revisions\/4106"}],"wp:attachment":[{"href":"https:\/\/lab.rapternet.us\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2989"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lab.rapternet.us\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2989"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lab.rapternet.us\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2989"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}