TFS Git存储库无法在Visual Studio 2015中同步

TFS Git存储库无法在Visual Studio 2015中同步

问题描述:

我的组织已投资于Team Foundation Server 2015,我们正处于设立团队和项目的初始阶段。我们尚未就使用哪种源代码控制(VSVC / Git)达成一致,但由于我有以前的Git经验,并且个人更喜欢它,所以我已经自行测试了Git如何与Visual Studio Enterprise 2015和我们的TFS站点集成。我将概述下面我采取的步骤,但是迄今为止我的结果让我相信VS中的一些设置与Git的身份验证设置或我们的公司防火墙冲突。我在寻求帮助或想法,我可以在哪里测试和验证什么设置不正确。

My organization has invested in Team Foundation Server 2015 and we are in the initial stages of setting up our teams and projects. We have yet to agree on which source control to use (VSVC/Git), but because I have previous Git experience and personally prefer it I have taken it upon myself to test how Git integrates with Visual Studio Enterprise 2015 and our TFS site. I will outline the steps I took below, but my results so far lead me to believe some setting in VS is in conflict with Git's authentication settings or our corporate firewall. I am asking for help or ideas of where I can test and verify what's not set correctly.

我的测试:


  • 在TFS中创建一个新的团队项目

  • 选择Git作为源代码管理并创建新的存储库

  • TFS团队项目代码选项卡中,单击在Visual Studio中克隆。
  • VS启动后,我按照提示将repo克隆到
    默认源目录中
  • >
  • 导航到我的文件系统上的repo目录并添加了新的
    空白文本文档

  • 已验证我可以在更改在VS中Team
    资源管理器窗口的一部分。

  • 使用内置的VS界面添加一个提交消息,然后我提示
    与服务器同步repo

  • 尝试同步并查看拉出当前分支,然后挂起并最终失败并显示以下两条错误消息之一:
  • Created a new team project in TFS
  • Chose Git as the source control and created new repository
  • From the TFS team project "Code" tab, clicked "Clone in Visual Studio"
  • After VS launches, I followed the prompt to clone the repo into the default source directory
  • Navigated to the repo directory on my file system and added a new blank text document
  • Verified I can see this change in the "Changes" section of the Team Explorer window in VS.
  • Used the built in VS interface to add a commit message and then I'm prompted to sync with the server repo
  • Attempt to sync and see "pulling the current branch", then it hangs and eventually fails with one of these two error messages:

遇到错误同时推送到远程存储库:响应
状态码不表示成功:504(连接超时)。

Error encountered while pushing to the remote repository: Response status code does not indicate success: 504 (Connection Timed Out).

推送到远程存储库时遇到错误:响应
状态码不表示成功:502(由对等方重置连接)。
推送到远程存储库时遇到错误:发送请求时发生错误

Error encountered while pushing to the remote repository: Response status code does not indicate success: 502 (Connection reset by peer). Error encountered while pushing to the remote repository: An error occurred while sending the request.

内部异常:
底层连接已关闭:服务器关闭了预期保持活动状态的连接。

Inner Exception: The underlying connection was closed: A connection that was expected to be kept alive was closed by the server.

当我尝试从命令执行相同的操作时不管是使用Git Bash还是CMD,都没有问题。我可以推/拉没有问题。当我在VS运行的时候这样做的时候,我实际上可以看到程序通过从团队资源管理器窗口中删除出站提交来响应我的推送。

When I attempt the same operations from the command line, either using Git Bash or CMD, there is no problem. I can push/pull without issue. When I do this while VS is running I can actually see the program respond to my push by removing the outgoing commits from the Team Explorer window.

当我在Bash中做'git remote -v'时,我看到:

When I do 'git remote -v' in Bash I see:


https://myOrgTFS.visualstudio.com/_git/my-team-project -name
(获取)

origin https://myOrgTFS.visualstudio.com/_git/my-team-project-name (推送)

在寻找这个问题的解决方案时,我下载并安装了 Git-Credential-Manager- for-Windows
安装完成后,我在Git配置中确认已设置凭证管理器。这似乎没有影响VS中的任何内容。同步过程仍然失败。

In looking for solutions for this issue I downloaded and installed the Git-Credential-Manager-for-Windows After install I confirmed in my Git config that the credential manager was set. This did not seem to affect anything in VS. Sync process still failed.

我在Windows中使用cmdkey.exe / list检查了我的凭据设置,发现此条目:

I checked my credential settings in Windows using "cmdkey.exe /list" and found this entry:

目标:LegacyGeneric:目标= GIT中: https://myOrgTFS.visualstudio.com 结果
类型:通用

用户:个人访问令牌

本地机器持久性

Target: LegacyGeneric:target=git:https://myOrgTFS.visualstudio.com
Type: Generic
User: Personal Access Token
Local machine persistence

看到这个我想设置我的git配置使用https://而不是git://,但这也没有改变VS的行为。
我知道TFS的我的安全部分,并已测试过设置与我的用户帐户匹配的备用身份验证凭据。没有工作。我还修改了我发布的个人访问令牌,以包含授权的所有范围,以防万一这里的设置阻止了我。这也没有改变VS同步失败。

Seeing this I thought to set my git config to use https:// instead of git://, but that too has not changed VS behavior. I'm aware of the "My Security" section of TFS and have tested setting alternate authentication credentials that match my user account. Didn't work. I also modified the personal access token I was issued to include "All scopes" of authorization just in case a setting here was blocking me. This also did not change the VS sync fail.

这个问题的一些读者可能认为这是一个非问题 - 只需使用命令行权限?我试图实现的是一个工作演示,我可以向我的程序员同事展示从未使用过Git的工作人员,并且只能在VS IDE中工作,而不是在命令行中工作。这些人仍然使用Visual Source Safe,因此我试图帮助他们指导他们使用Git并展示它如何与IDE工作流集成。

Some readers of this question may think this is a non-issue - just use the command line right? What I'm trying to achieve is a working demo I can show my programmer coworkers who have never used Git and are only comfortable working within the VS IDE, not the command line. These are people who still use Visual Source Safe, so I'm trying to help guide them toward using Git and show how it can integrate with their IDE workflow.

任何建议或者关于如何确定为什么VS Git失败,但Bash Git的作品的想法。谢谢!

Any suggestions or ideas on how I can determine why the VS Git fails but the Bash Git works are appreciated. Thank you!

使用Git 2.9.0.windows.1和VS 2015 Enterprise Update 3

Using Git version 2.9.0.windows.1 and VS 2015 Enterprise Update 3

我刚刚在tfs和visual studio 2015中遇到了一个类似问题,由于504错误,我无法同步或推送。编辑在文件devenv.exe.config(该devenv.exe的配置文件)之后的问题解决了:%PROGRAMFILES%\Microsoft的Visual Studio 14.0\Common7\IDE(或%PROGRAMFILES(x86)的%\Microsoft的Visual Studio 14.0 \Common7\IDE)。
在配置文件中,找到该块,并添加以下代码:

I just had a simular problem with tfs and visual studio 2015, i could not sync or push because of 504 error. Problem solved after editing the file devenv.exe.config (the devenv.exe configuration file) in: %ProgramFiles%\Microsoft Visual Studio 14.0\Common7\IDE (or %ProgramFiles(x86)%\Microsoft Visual Studio 14.0\Common7\IDE). In the configuration file, find the block, and add this code:

<defaultProxy enabled="true" useDefaultCredentials="true">  
    <proxy bypassonlocal="True" proxyaddress="http://yourproxy:port"/>  
</defaultProxy>  

您必须在proxyaddress =

You must insert the correct proxy address for your network in proxyaddress=""

如果您不知道代理名称:port,请打开Chrome浏览器并输入地址类型

If you don't know the proxy name:port, open chrome browser and in address type

chrome://net-internals/#proxy

左列选择代理以获取详细信息

Left column choose proxy for details