How do I ignore a file that is already committed?

Adding it to .gitignore is not enough — Git keeps tracking what it already tracks.

.gitignore applies only to files Git is not tracking. Once a file has been committed, adding it changes nothing at all: Git goes on recording every change to it.

Two steps:

  1. Add the rule. On an untracked file, Innesta writes it for you from the row’s context menu; here you will be editing .gitignore yourself, since the file is not in the untracked group.

  2. Stop tracking the file, keeping it on disk:

    git rm --cached <path>
    

Then commit both — the .gitignore change and the removal. From that commit on, the file is ignored.