Reputation: 259
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
Reputation: 6037
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
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
Upvotes: 0