Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
684 views
in Technique[技术] by (71.8m points)

visual studio 2013 - TFS/Git extensions seems to ignore .gitignore

I'm running VS 2013 Update 3 with the 'Visual Studio Tools for Git' extension. This extension is for users of both team explorer and Git and I have no other Git and TFS related extensions installed and running. I use Microsoft's TFS Cloud service to backup and share my work.

Everything worked as expected for a few months. I want to be able to use this VS extension again, but the problem is that the files that should be ignored by .gitignore are being included by default. The same Git repository when viewed from the command line does not have this problem and works as expected.

Possibly important: I have at one time half-way set up a straight TFS account online but never used it locally and that never correlated with any problems I have mentioned here. Also, a long time ago I had to follow the advice in another posting to remove these binary files from version control because I added the .gitignore file too late. Since the command line doesn't have this problem I think something else is at work and that --hard reset actually worked as intended.

What is the problem with VS? Is there some way to change a setting or generally correct the oversight to ignore the files in the .gitignore file in the Git directory but not ignore the .gitignore file?

To head off some potential questions: I confirmed that the directories, and branches are the same on both interfaces by observing that all changes are added to Git/TFS and Posh Git as well as Git Bash and all other Git interfaces I have tried. The only problem is that additional files that should be ignored are not ignored in the VS extension.

Here is a sample of the .gitignore file that I use, which was produced by VS:

## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.

# User-specific files
*.suo
*.user
*.sln.docstates

# Build results

[Dd]ebug/
[Rr]elease/
x64/
build/
[Bb]in/
[Oo]bj/

enter image description here

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

We recently had the the same problem with the VS2013 git provider ignoring the .gitignore for only a few files. It turned out, there was ms-persist.xml in the .git folder with the two relevant sections <TrackedFiles> and <IgnoredFiles>.

As suggest in a blog post by Eric Nelson closing VS, deleting the file and restarting VS again solved the problem.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...