Yaseen
Yaseen

Reputation: 259

Authentication failed error while pulling from TFS through PAT

I have a TFS repo with some source files. Checkout using the username and password works as expected. But when I try with PAT, it shows the error below.

git -c http.sslVerify=false clone https://<username>:<PAT>@<Repo-URL>
Cloning into 'Project'...
fatal: Authentication failed for 'Repo-URL'

PAT has full privileges Does anyone know what is the exact issue here?

Upvotes: -1

Views: 74

Answers (1)

Alvin Zhao - MSFT
Alvin Zhao - MSFT

Reputation: 6037

Update

After a further test in a fresh environment, you may authenticate against a base64 encoded PAT.

$PAT = "xxxxxx"

$B64Pat = [Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes(":$PAT"))

git -c http.extraheader="AUTHORIZATION: Basic $B64Pat" clone http://aztfs/DefaultCollection/MyProject/_git/MyRepo

enter image description here


I could reproduce the authentication failure when adding the <username> in the repo URL. It worked from my side if I ran git clone using PAT directly without any username in the repo URL.

$PAT = "xxxxxx"

git clone http://$PAT@aztfs/DefaultCollection/MyProject/_git/MyRepo

Image

Upvotes: 0

Related Questions