GIT - Can't ignore .suo file

C#Git

C# Problem Overview


I'm trying to work using Git with a colleague, in an application written in C#.

We have added the entry "project1.suo" to the .gitignore file but every time one of us has to commit the project, Git seems to tell us to commit the file "project1.suo" as well.

We have tried many methods to add the file in .gitignore like that:

*.suo
project1.suo
c:\project\project1.suo

We cannot fix this problem.

C# Solutions


Solution 1 - C#

git doesn't ignore files that have been added to the repository. If you want to get it ignored, you have to delete the file from the repository:

git rm --cached project1.suo
git commit -m "Delete suo file from repository"

This will delete the file from the repository, while it's still on your harddrive.

Solution 2 - C#

I always back to this question to use the method in the answer but i found a better solution which is to ignore the changes to this file . The method is

git update-index --assume-unchanged project1.suo

or

git update-index --assume-unchanged .vs/config/applicationhost.config

To undo this use --no-assume-unchanged

Solution 3 - C#

I had the same problem. Ikke's solution helps, but do not forget to remove the *.suo entry from your .gitignore, if it is there. After the file is corrected, do

git add **/*.suo

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionLaxedurView Question on Stackoverflow
Solution 1 - C#IkkeView Answer on Stackoverflow
Solution 2 - C#TareqView Answer on Stackoverflow
Solution 3 - C#Tsvetelina TsvetanskaView Answer on Stackoverflow