Do the following to trigger the gitignore:
Commit all your pending changes in the repository which you want to fix and push that.
Remove everything from the git index in order to refresh your git repository. This is safe. Use this command:
$ git rm -r --cached .
Add everything back into the repo, which can be done using this command:
$ git add .
Commit these changes, using this command:
$ git commit -m "Gitignore issue fixed"