Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 991
Can Poyrazoğlu Avatar asked May 11 '16 08:05

Can Poyrazoğlu


People also ask

Where is applicationHost config file located?

The location of the file is currently in the %windir%\system32\inetsrv\config directory.

Do we need .VS folder in git?

No, you should not add it to source control. The purpose of this folder is to move machine- and user-specific files to a central location. The explanation on the Visual Studio User Voice issue explains it well: So far, we have moved the .

What is the purpose of gitignore file?

The purpose of gitignore files is to ensure that certain files not tracked by Git remain untracked. To stop tracking a file that is currently tracked, use git rm --cached.


1 Answers

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:]]' See documentation for git ls-files.

I believe this blog entry can be more descriptive.

like image 177
Konrad 'Zegis' Avatar answered Sep 18 '22 15:09

Konrad 'Zegis'