Git provides an option to ignore certain files being committed into the main repository. We need to save the filenames to ".gitignore" file to ignore those from commit.
Make sure that trailing white space in the content of .gitignore file for the proper functioning.
Sometimes .gitignore file behaves weirdly and GIT fails to ignore all the file names listed in the .gitignore file.
We can follow the below steps to resolve this problem.
Step1: Commit all the pending changes in the repo which need to be fixed.
Step2: Remove everything from the git index in order to refresh the git repository.
#git rm -r --cached .
Step3: Add everything back into the repo for commit.
#git add .
Step4: Commit the changes.
#git commit -m ".gitignore Fixed"
Step5: Push the files.