Visual Studio - git pull 导致错误 [英] Visual studio - git pull causes error

查看:26
本文介绍了Visual Studio - git pull 导致错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 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:VSProject>git 状态

C:VSProject>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).

我该怎么做才能拉取提交?

Whan can I do to pull commits?

推荐答案

Visual Studio 2013 到 Update 3 中存在一个错误,当您拥有 core.autocrlf 时,它会阻止您在某些情况下合并设置为 true 但存储库中的文件未正确规范化.我们正在将您的工作文件夹的内容(具有 Windows 样式的 ' 行结尾)与您声明的存储库内容进行比较(通过设置 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 ' line endings) to the contents of your repository, which you have claimed (by setting core.autocrlf=true) have Unix style line endings.

如果实际上您的存储库包含带有 行结尾的文件,那么我们将错误地报告这些文件在您的工作目录中被修改并阻止合并.(当然,我们应该查看索引中的时间戳,而根本不需要测试这些文件.)

If, in fact, your repository contains files with 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 团队服务.

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆