How to Remove Secrets from Git History

preview_player
Показать описание
You have a password or some secret in your Git repository, and you want to remove it. I recently had the same problem in one of my repositories. I will show you a convenient and simple way to get rid of any accidentally committed secret in your Git repository.

Today, I will show you a simple but effective way to get rid of secrets in your Git repository.

We committed a secret into a Git repository. The secret will always remain in the Git history.

While there are native Git commands like git filter-branch that we can use to rewrite the Git history, it still is somewhat error-prone. It is especially true if you haven't used those commands before.

Luckily, I came across BFG Repo Cleaner.

00:00 Introduction
00:35 The Problem
01:29 Possible Solutions
01:51 BFG Repo Cleaner
02:22 Removing Secrets
03:55 Exposed Secrets

🔥 C#/.NET Bootcamp: The Fundamentals & more (Code FRIENDS10 for 10% OFF)*

📌 .NET Developer Roadmap

📌 YouTube Playlists:

📋 BFG Repo Cleaner

✅ SUBSCRIBE FOR MORE VIDEOS

🚀 CONNECT & SUPPORT

CREDITS
✴ Title Photo by krakenimages on Unsplash.

* Affiliate Link: I earn a small commission at no additional cost
Рекомендации по теме
Комментарии
Автор

Do you have any other tips and tricks for using Git?

ClaudioBernasconi
Автор

I really needed this. Worked flawlessly, thank you

Trapson
Автор

Great tip. I didn't want the default ***REMOVED*** as the text replacement so I used in my .TXT file :

OLDTEXT==>NEWTEXT

and the NEWTEXT was now in all files and history!!

timweiss
Автор

great video friend, it helped me a lot

greetings from Brazil

danilovieirarocha
Автор

I forgot to add the .env in gitignore and all my credentials went to the local and remote repository... At least there's only me in the project and the remote repository is private 😅

HernaniSamuel
Автор

brilliant video - really helped thanks

sleslie
Автор

what about merged pull requests ? can we clean that too?

AdityaYada
Автор

Nice,
Can we remove the secret key from specific branch ?

harishkumarkr
Автор

I prefer not using another tool with my passwords: the less tools are used to manage them, the more secured will be my passwords.

dioxino
Автор

I used the same method as you described, but it replaced every text of the file with ***REMOVED***, I'm not sure how to make it so it will replace only the specific word with ***REMOVED***. How can i achieve that?

RebelionDNA
Автор

Hello, What's the UI you are using in this video? Thanks

paulhere
Автор

I was able to see my changes in github desktop but, it's not moving into github repo, any idea on this?

varun_
Автор

do you have a video to do the same but for a file ? like a png ? to remove it entierly ?

Fangh