Bassie
Bassie

Reputation: 10390

Authentication Fails When Cloning TFS repo with Git

I have always created local repositories using this command:

git clone http://TFSServer:8080/tfs/Scripts/_git/ProjectName

However, when I do it at the moment I get this message:

Cloning into 'ProjectName' ...

fatal: Authentication failed for 'http://TFSServer:8080/tfs/Scripts/_git/ProjectName/'


When starting up Visual Studio Code I see this error:

unable to get local issuer certificate

and when trying to push to TFS from VSCode (which I have always been able to do in the past), I see this error:

Authentication failed on the git remote


After checking the repo permissions, I can see that I have full permissions:

enter image description here

Upvotes: 13

Views: 20798

Answers (4)

Miguel
Miguel

Reputation: 1714

In my case the issue was resolved changing settings in Visual Studio. I got the instructions from this post on Microsoft's Developer Community.

Git Clone from TFS: Authentication error

Depending on what kind of secure channel are you using to connect to your repo the solution for this issue could be different. In my case I'm using OpenSSL and the steps to fix the problem are ase follows:

  1. Open Visual Studio.
  2. Click on Team Explorer > Settings > Global Settings
  3. Change the Cryptographic network provider to OpenSSL.

Upvotes: 0

Bassie
Bassie

Reputation: 10390

It turns out that this only started happening after I needed to change Windows logon password.

The password was updated locally and on the TFS server, but not in the cached credentials for git.

Fix

Control Panel -> Credential Manager -> Generic Credentials

Then update the password for git:http://ServerName:1234/

Now I can successfully access the repo from command line and VS Code.

Upvotes: 46

Cece Dong - MSFT
Cece Dong - MSFT

Reputation: 31023

Please check the Git repository 'ProjectName' permissions to see whether you have the Read permission, or grant your account the Read permssion:

enter image description here

Upvotes: 2

Daniel Mann
Daniel Mann

Reputation: 59020

I can almost guarantee you that the URL you're using is wrong.

It should typically be: git clone http://<tfs uri>/tfs/<team project collection name>/<team project name>/_git/<repo name>

Upvotes: -1

Related Questions