Visual Studio - git pull会导致错误 [英] Visual studio - git pull causes error
问题描述
我在Visual Studio Team Services上有一个Git仓库。当我尝试提交提交时,出现以下错误:
I have a Git repository on Visual Studio Team Services. When I try to pull commits, I get the following error:
18个未提交的更改将被合并覆盖
18 uncommitted changes would be overwritten by merge
我在SO上发现了一些问题,推荐提交/存储/等地方更改。问题是我没有任何本地更改。这是什么 git status
输出:
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
C:\VS\Project>git status
没有提交,工作目录干净
nothing to commit, working directory clean
没有本地更改。更重要的是,当我通过命令行工具尝试 git pull
,但我无法登录时 - 我的VS Team Services凭据无法使用(但我可以通过Web浏览器或由VS没有任何问题)。
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).
我可以做拉提交?
推荐答案
在Visual Studio 2013中通过Update 3存在一个错误,当您将 core.autocrlf
设置为 true
但是你的版本库中的文件不正确的标准化。我们正在比较你的工作文件夹的内容(它具有Windows风格的'\r\\\
行结尾)到您声明的存储库的内容(通过设置
core.autocrlf = true
)具有Unix风格 \\\
行尾。
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.
如果您的存储库实际上包含带有 \r\\\
行结尾的文件,那么我们将错误地报告这些文件被修改为你的工作目录并防止合并。 (当然,我们应该查看索引中的时间戳,并且根本不打算测试这些文件。)
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.)
虽然这个是 Visual Studio中的一个错误(并且会在下一次更新中修复),这掩盖了您的存储库配置不正确的事实。您应该配置 .gitattributes
文件和更正存储库中的行结尾,以避免这些问题。
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.
同时,可以在命令行中使用Git for Windows,为了解决这个问题,请务必配置备用凭证在 Visual Studio Team Services 。
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.
这篇关于Visual Studio - git pull会导致错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!