How to Fix: Gitignore is not Working

RECOMMENDED: Click here to fix Windows errors and optimize system performance

GitHub has established itself as one of the pioneers in the field of code collaboration and repository sharing. GitHub is mainly version control software that allows users to control distributed version control and source code management (SCM). This platform is used by large companies and companies around the world.

What makes .gitignore not work?

The.gitignore function can work correctly, but you may not have configured it correctly. In all our investigations, we have come to the conclusion that the module actually works. The main reason programmers cannot use this feature is that they have not configured the file correctly, or because there are certain conditions that are not met in the underlying code.

Ignored files are generally compilation artifacts and machine-generated files that can be derived from the sources of your repository or that should not otherwise be transferred.

Here are some solutions that may be right for you. Any solution may not be applicable in your case, so be sure to move on to the next solution if the initial conditions are not met.

A very quick solution to this problem would be to get rid of any white space in the.gitignore file if you find one. In addition, you should not place comments next to the file listed in the.gitignore file.

If it appears that Git does not notice the changes you have made to your.gitignore file, you should check the following points:

There may be a global.gitignore file that could interfere with your local file.

If you add something to a.gitignore file, try this:

  • git add [uncommitted changes you want to keep] && git commit
  • git rm -r –cached .
  • git add .
  • git commit -m “fixed untracked files”

Delete the monitored files from the repository

To solve the problem, delete the files tracked from the repository that are contained in the.gitignore file. To do this, use “git rm” to delete and decompress all files in the repository, then use “git add” to add all files (the files in the.gitignore file are not added), and finally validate the changes.

April 2021 Update:

We now recommend using this tool for your error. Additionally, this tool fixes common computer errors, protects you against file loss, malware, hardware failures and optimizes your PC for maximum performance. You can fix your PC problems quickly and prevent others from happening with this software:

  • Step 1 : Download PC Repair & Optimizer Tool (Windows 10, 8, 7, XP, Vista – Microsoft Gold Certified).
  • Step 2 : Click “Start Scan” to find Windows registry issues that could be causing PC problems.
  • Step 3 : Click “Repair All” to fix all issues.


  • git rm -r –cached .
  • git add .
  • git commit -m “untrack files contained in the .gitignore file”

Be consistent with the master

Before you even try to execute a command from this station, make sure you have confirmed all the changes you have made locally, and also that you have retrieved the master code from your local repo that others have made.

Reinsertion of files in the repository

If you have already added rules in.gitignore, but the files you want to ignore have already been added, we can add them again. Adding means that we remove everything from the git index and then add it to your repository. When we add files again from scratch, the rules you added in.gitignore are taken into account and only the right files are added.


That should be it. Git is one of the most powerful tools we have ever seen in our lives. It makes our lives easier. The more complex your configuration is, the easier it is to manage with these code versioning tools.

RECOMMENDED: Click here to troubleshoot Windows errors and optimize system performance