简体   繁体   中英

GIT - Can't ignore .suo file

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.

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.

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

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

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