4

We have an internal hosted instance of Team Foundation Server 2013 with many projects that use GIT source control. If I use Visual Studio 2015, I am able to clone, push, pull, etc. with no problem. However when I try to interact with the server using the git command line, git is unable to communicate with the server. For example, when I try to clone a repository (I am 100% positive that the url is valid), it errors. Here is the output

C:\Projects\>git clone http://tfs_server_name:8080/tfs/CollectionName/_git/SomeProject
Cloning into 'SomeProject'...
fatal: repository 'http://tfs_server_name:8080/tfs/CollectionName/_git/SomeProject/' not found

Our TFS instance is configured to use integrated windows authentication, and so I followed the instructions from this article: https://github.com/Microsoft/Git-Credential-Manager-for-Windows/blob/master/Docs/Faq.md#q-i-thought-microsoft-was-maintaining-this-why-does-the-gcm-not-work-as-expected-with-tfs

I ran the command from that article as instructed (where tfs_server_name is the machine name of our server, and NameOfOurDomain.lcl is our domain):

git config --global credential.tfs_server_name.NameOfOurDomain.lcl.integrated true

This didn't fix the problem either. I ran the command, tried to clone, nothing. I rebooted, tried to clone, nothing.

What else can I do to get git to authenticate against that server?

TwitchBronBron
  • 2,783
  • 3
  • 21
  • 45
  • That doesn't look like the URL for a valid git repository to me. Typically I would expect it to end with .git. – Jack Bracken Oct 24 '16 at 16:08
  • @JackBracken, This git repo is stored on a TFS server. That url was retrieved directly from the .git/config file under the `[remote "origin"]` section that is created when I clone the repo from within Visual Studio. Also, I don't believe the .git extension is mandatory for git repositories, it is just a common convention. (http://stackoverflow.com/questions/11068576/why-do-some-repository-urls-end-in-git-while-others-dont) – TwitchBronBron Oct 24 '16 at 16:17
  • Which version of Git do you use? Did you type your username and password for TFS? – Cece Dong - MSFT Oct 25 '16 at 04:34
  • I'm using git version 2.10.1.windows.1 64 bit, and it never prompts me for a username and password – TwitchBronBron Oct 25 '16 at 14:27

4 Answers4

3

Do you have any proxy settings set? Check for global git settings for http.proxy and https.proxy in the .gitconfig file in your profile. Also, verify that you don't have any environment variables set pointing to a proxy server (HTTP_PROXY and HTTPS_PROXY).

Most proxy servers do not allow internal access, so it is possible that, if you have git configured to point to a proxy, the TFS server actually can't be seen by the proxy server and therefore git can't see the repository.

Blake
  • 58
  • 4
  • This was totally the problem. I didn't have any .gitconfig proxy settings set, but I had HTTP_PROXY and HTTPS_PROXY environment variables set, so git was using those. Once I removed the environment variables, I was able to see the internal server. Using this post, I was able to set up my .gitconfig file to use proxy for everything EXCEPT my internal TFS server. http://stackoverflow.com/questions/16067534/only-use-a-proxy-for-certain-git-urls-domains/18712501#18712501 – TwitchBronBron Oct 28 '16 at 16:57
0

I just tried with Git command line + TFS 2013.5, no issue occurred.

  1. Make sure you are using the latest Git (I'm using 2.10.1 64-bit version of Git for Windows).
  2. Remove the credential of git: http://tfsserver:8080 in Credential Manager.
  3. Type the credential that can access the repo to clone it.

enter image description here

Cece Dong - MSFT
  • 29,631
  • 1
  • 24
  • 39
  • 1
    I installed the latest, confirmed by running git --version, still have the same issue as the OP. – James Lawruk Oct 25 '16 at 13:44
  • I'm using the same version that you are using (2.10.1.windows.1 64bit). I cleared out every credential in my credential manager, and then ran git clone again. That login prompt never appears. It just outputs `fatal: repository ... not found`. – TwitchBronBron Oct 25 '16 at 14:30
  • @TwitchBronBron Did you try on another machine? If you try on TFS server machine, are you able to get login prompt? – Cece Dong - MSFT Oct 26 '16 at 01:58
  • I tried it on another machine and it still doesn't display the login prompt. I don't have rights to log in to the TFS server, so I can't try it on there. – TwitchBronBron Oct 28 '16 at 14:57
  • in my case when i did a git tfs pull i had to specify --username after deleting credentials to force it to prompt me to re-enter them (they had expired) – Justin Aug 15 '22 at 16:02
0

The URL you provided is incorrect.

Your URL:

http://tfs_server_name:8080/tfs/TeamProjectName/_git/SomeProject/

Correct URL:

http://tfs_server_name:8080/tfs/CollectionName/_git/ProjectName/

Since you mentioned it works with VS2015, so you can check the URL from "Visual Studio\Team Explorer\Settings\Repository Settings\Remotes".

Eddie Chen - MSFT
  • 29,708
  • 2
  • 46
  • 60
  • I'm positive that url is correct. I just did a terrible job filtering out the sensitive information in the url for this post. I incorrectly named it TeamProjectName when it should have been CollectionName. I have updated my question to better reflect this. – TwitchBronBron Oct 27 '16 at 11:09
  • @TwitchBronBron Then did you check if the URL is the same with the one in Visual Studio? – Eddie Chen - MSFT Oct 28 '16 at 00:25
  • I did check. The URL that I am using is indeed the same as what Visual Studio is showing. – TwitchBronBron Oct 28 '16 at 14:53
-1

This is a bit convoluted, but it may help the cause.

In your command prompt:

runas /profile /user:your_domain\your-user-id "cmd.exe"

This opens a new command prompt window. In the new window...

cd c:\projects
git clone http://tfs_server_name:8080/tfs/TeamProjectName/_git/SomeProject
James Lawruk
  • 30,112
  • 19
  • 130
  • 137