# Deleting Secrets from a Git repository

#### Step 1: Use the filter-branch command

```bash
git filter-branch --force --index-filter \
  "git rm --cached --ignore-unmatch <PATH-TO-YOUR-FILE-WITH-SENSITIVE-DATA>" \
  --prune-empty --tag-name-filter cat -- --all
```

#### Step 2: Push your local changes to a remote repository

```bash
git push origin --force
```

