Then in Git Bash you have to write the following line:
git config --global core.excludesfile ~/.gitignore_global
--------------------------------------------------------------------
If the repository already exists then you have to do the following:
git rm -r --cached .
git add .
git commit -m ".gitignore is now working"
If the step 2 doesn’t work then you should write the whole route of the files that you would like to add.
$ echo debug.log >> .gitignore
$ git rm --cached debug.log
rm 'debug.log'
$ git commit -m "Start ignoring debug.log"
just put the name or the path to your file in a .gitignore file, like this:
your_file.svg <-- ignore the file your_file.svg
*.sql <-- ignore any .sql files
ihm/test/ <-- ignore the whole "test" folder in "ihm"
git reset name_of_file