Visual studio - git pull causes error

2019-02-27 12:14发布

I have a Git repository on Visual Studio Team Services. When I try to pull commits, I get the following error:

18 uncommitted changes would be overwritten by merge

I've found some question on SO that recommends committing / stashing / etc. local changes. The problem is that I have no any local changes. Here is what git status outputs:

C:\VS\Project>git status

nothing to commit, working directory clean

There is no local changes. What's more, when I tried to git pull via command line tools, but I can't login - my credentials for VS Team Services doesn't work (but I can log via web browser or by VS without any problems).

Whan can I do to pull commits?

1条回答
在下西门庆
2楼-- · 2019-02-27 12:33

There is a bug in Visual Studio 2013 through Update 3 that will prevent you from merging in certain circumstances when you have core.autocrlf set to true yet the files in your repository are incorrectly normalized. We are comparing the contents of your working folder (which has Windows-style '\r\n line endings) to the contents of your repository, which you have claimed (by setting core.autocrlf=true) have Unix style \n line endings.

If, in fact, your repository contains files with \r\n line endings, then we will incorrect report these files as modified in your working directory and prevent the merge. (We should, of course, be looking at the timestamp in the index and not bothering to test these files at all.)

While this is a bug in Visual Studio (and will be fixed in the next Update), it is obscuring the fact that your repository is not configured correctly. You should configure a .gitattributes file and correct the line endings in your repository to avoid these sorts of problems.

In the meantime, you can use Git for Windows on the command-line to solve this problem, please be sure to configure alternate credentials in Visual Studio Team Services.

查看更多
登录 后发表回答