---
title: "Comment by James 'Dante' Midzi on \"Removing a .env file from Git history\" | Hashnode"
description: "I had to do this a couple of days back. Thank you for this"
url: "https://hashnode.com/posts/removing-a-env-file-from-git-history/618b5c6c468c06249afc5a33/comment/618ca17c468c06249afc72e4"
---

[Discussion](https://hashnode.com/posts/removing-a-env-file-from-git-history/618b5c6c468c06249afc5a33)

Comment [Removing a .env file from Git history](https://hashnode.com/posts/removing-a-env-file-from-git-history/618b5c6c468c06249afc5a33)

[James 'Dante' Midzi](https://hashnode.com/@Psypher1)

[Nov 11, 2021](https://hashnode.com/posts/removing-a-env-file-from-git-history/618b5c6c468c06249afc5a33/comment/618ca17c468c06249afc72e4)

I had to do this a couple of days back. Thank you for this

[Chris Bongers](https://hashnode.com/@dailydevtips)

[Nov 11, 2021](https://hashnode.com/posts/removing-a-env-file-from-git-history/618b5c6c468c06249afc5a33/comment/618ca17c468c06249afc72e4#reply-618ca35ef991b025366e2097)

Happens to everyone.

I've added a small subnote: If you accidentally pushed real-world secrets to a repo, you should always revoke and regenerate them.

[James 'Dante' Midzi](https://hashnode.com/@Psypher1)

[Nov 11, 2021](https://hashnode.com/posts/removing-a-env-file-from-git-history/618b5c6c468c06249afc5a33/comment/618ca17c468c06249afc72e4#reply-618ca56c468c06249afc733f)

Thanks for that, I will definitely keep that in mind.
