# filter-repo

Oh no! I've committed a secret to my repository, and pushed the changes!&#x20;

{% hint style="warning" %}
If you alreay pushed the changes, you might want to revoke the secret.
{% endhint %}

<details>

<summary>Can't I just amend the commit and force push?</summary>

Even if you force push, the commit will still exist somewhere in the git in remote

</details>

git-filter-repo is an add-on to git that allows you to remove secrets from your git completely. Remember that, even if we amend a commit, the commit that contains our secrets still remain in the tree. We'll need a way to remove that

{% @github-files/github-code-block url="<https://github.com/newren/git-filter-repo>" %}

Once you've installed git-filter-repo, run:

```bash
git-filter-repo --force --invert-paths --path <path-to-secret>
```
