问题
For my remote repository, I'm trying to ignore the web.config file of my Umbraco website. The .gitignore is in the root of my website, and the file to ignore, web.config is also in the root of my website.
so I added this line to my .gitignore file:
web.config
But everytime I push changes to my remote repository, the web.config file is also pushed to the remote repository.
What am I doing wrong?
回答1:
git will not ignore a file that was already tracked before a rule was added to this file to ignore it. In such a case the file must be un-tracked with git rm --cached <filename>
.
So if you are trying to ignore this file newly, run this: git rm --cached web.config
.
来源:https://stackoverflow.com/questions/22038600/gitignore-not-ignoring-web-config