Reputation: 1485
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?
Upvotes: 43
Views: 34002
Reputation: 9624
git will not ignore a file that's already tracked before a rule is 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
.
Upvotes: 70
Reputation: 1077
first make sure that the path of the web.config
relative to the solution is correct
it could be for instance /Directory/Web.config
if you already made changes to web.config
it won't be ignored unless you make the following:
git rm --cached web.config
to reset track.web.config
file that will be stagedgit update-index --really-refresh
Upvotes: 0
Reputation: 1829
If the only you want to do is to prevent commits of web.config that you are running locally without affecting the one inchecked then run this command (in cmd or ps) under your project folder.
git update-index --assume-unchanged web.config
Upvotes: 20