0
votes

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.

My test:

  • 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:

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

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.

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.

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

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

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.

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

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

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.

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.

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

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

2

2 Answers

1
votes

It seems there are some connection error during the sync. Make sure connection between VS and TFS works well without any problem. Try to create a new repository to narrow down whether related to the repository. Also Clear VS and TFS cache and try it again.

Moreover, below blogs you can send to your coworkers to help them quickly get started with GIT, VS ,TFS.

1
votes

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>  

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

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