If you add to .gitignore:
.ipynb_checkpoints
(no slashes anywhere), any file or directory in the repo with that name will be ignored. Paths are only checked if you include /.
From this answer you can also have a global gitignore for your computer:
git config --global core.excludesfile '~/.gitignore'
echo '.ipynb_checkpoints' >> ~/.gitignore