Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

gitignore doesn't ignore .suo Visual studio file

Tags:

git

github

I want to do simple thing, ignore .suo file and bin and obj folders from committing to git repo. I've created .gitignore file and it's working for bin and obj folders, but it keeps allowing .suo file committing. The content of gitignore is simple:

/build/ *.suo *.user _ReSharper.*/ *.sdf bin/ obj/ Debug/ Release/ *.opensdf *.tlog *.log TestResult.xml *.VisualState.xml Version.cs Version.h Version.cpp 

Firstly I've thought that the problem is that .suo file is already on the repo, so I've used set of git commands to remove it from repo:

git rm "file.suo" git commit -m "suo removed" git pull origin master git push origin master 

And everything goes well, .suo is removed locally, it is removed from repo, and on the next commit it gets pushed again to repo.

On the picture is committed .suo file.

enter image description here

Did anyone had a problem like this? How to solve this kind of problem?

like image 311
nemo_87 Avatar asked Feb 27 '15 07:02

nemo_87


People also ask

Why is my file not being ignored in Gitignore?

gitignore ignores only untracked files. Your files are marked as modified - meaning they were committed in the past, and git now tracks them. To ignore them, you first need to delete them, git rm them, commit and then ignore them.

How do I ignore files in Git using Visual Studio?

Visual Studio GitIn the Git Changes window, right-click any changed file that you want Git to ignore and choose Ignore this local item or Ignore this extension.

How do I ignore a .cache file in Git?

gitignore rule for it. Using the --cached option with git rm means that the file will be deleted from your repository, but will remain in your working directory as an ignored file. You can omit the --cached option if you want to delete the file from both the repository and your local file system.

How do I ignore a .vscode file in Git?

For those who want to exclude a file vie private ignore using . git/info/exclude .


1 Answers

This is probably a duplicate of GIT - Can't ignore .suo file

And to be honest, you can try that suggestion. What you are missing here is to remove the already added *.suo file from the git repository.

The other answer has a nice set of commands to run:

git rm --cached *.suo git commit -m "Delete suo file from repository" 
like image 121
Jesper Rønn-Jensen Avatar answered Sep 19 '22 17:09

Jesper Rønn-Jensen