File added to .gitignore still showing as untracked list

git May 02, 2019

sometimes we forget to put all the files which need to be ignored before pushing it to the repo. Later, when we add the file in the .gitignore file, the file still shows up in the untracked list. Today we will learn how can get fix the .gitignore issue.

Before moving with the next step, make sure your changes are committed.

Removing all the files from repo

To clear your repo, use:

git rm -r --cached .

this will remove any changes file from the index

Add the files again

git add .

commit your changes

git commit -m ".fixing gitignore"

You are done!

Now, the files added in the .gitignore files will not show up in the untracked list.

Rohit Shrestha

have a keen interest in building web applications Currently, I work as a consultant for various health-related agencies to leverage the power of data and improve their system for maximum efficiency.