简体   繁体   中英

Why is applicationhost.config still being added to source control even thought it's in gitignore

First of all, I've seen .vs\\config\\applicationhost.config in source control .

We are working in a team and Visual Studio changes some path inside applicationhost.config file. We need to exclude this. In my .gitignore file, I've added:

/.vs/config/applicationhost.config

However, in every commit, this is again added to the git. Before VS2015 Update 2, it was no issue, but something has changed to git integration with VS after this update and now it's being included. Whenever my workmates pull changes to the branch, their IIS Express fails because of the changes to this file (it has paths local to my own PC's paths etc.) and vice versa.

How do I pull this file out of the source control completely?

Do you have applicationhost.config file already in repository before adding it to .gitignore file?

If so you need to use command git rm --cached [file] .

Purpose of .gitignore file is to keep untracked files untracked, so it wont affect files that you already track.

EDIT:

As I totally forgot: Above solution works for repository, so all developers working will be forced to maintain their own copy.

To prevent git from detecting changes you should also use this: git update-index --assume-unchanged [path_or_file] And if - in future - you would want to start tracking changes again you'll need to revert update via: git update-index --no-assume-unchanged <file>

And to see files marked with --assume-uchanged flag you can use this: git ls-files -v | grep '^[[:lower:]]' git ls-files -v | grep '^[[:lower:]]' See documentation for git ls-files .

I believe this blog entry can be more descriptive.

Try the command:

git rm /.vs/config/applicationhost.config

Then commit changes to repository.

The line in .gitignore just give to git information, that this file should not be listed as "untracked files" in git status output

First of all, I've seen .vs\\config\\applicationhost.config in source control .

We are working in a team and Visual Studio changes some path inside applicationhost.config file. We need to exclude this. In my .gitignore file, I've added:

/.vs/config/applicationhost.config

However, in every commit, this is again added to the git. Before VS2015 Update 2, it was no issue, but something has changed to git integration with VS after this update and now it's being included. Whenever my workmates pull changes to the branch, their IIS Express fails because of the changes to this file (it has paths local to my own PC's paths etc.) and vice versa.

How do I pull this file out of the source control completely?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM