Reputation: 12403
ok, our org has the code in an azure dev ops repo.
I have been trying to clone it via git command line on the mac, via sourcetree on the mac and via sourcetree on windows, with no luck.
I created a PAT in the azure git web UI.
on the mac, if I do:
$ git clone https://ourorg.visualstudio.com/CMS/_git/ourProj
Cloning into 'ourProj'...
Username for 'https://ourorg.visualstudio.com': xxx
Password for 'https://[email protected]':
fatal: Authentication failed for 'https://ourorg.visualstudio.com/CMS/_git/ourProj/'
For user, I tried my azure user, and I also tried the PAT. For pass, I tired my azure pass, and also the PAT.
None of these options work.
For sourcetree, I have also tried these combinations o PAT/PAT user/PAT user/pass etc. with no luck. Any suggestions?
This is the page I used to create the PAT:
This doc says to use the PAT as the user and pass, but this simply doesnt work.
the doc also says you can do this:
git clone https://anything:{yourPAT}@dev.azure.com/yourOrgName/yourProjectName/_git/yourRepoName
But this does not work either.
e.g. If I do this (fixed thanks to jessejouwing):
$ git clone https://asdf:{myPATgoesHERE}@dev.azure.com/ourorg/CMS/_git/ourProj
On windows I always get:
Cloning into 'ourProj'... fatal: Authentication failed for 'https://dev.azure.com/ourorg/CMS/_git/ourProj/'
The PAT is 100% correct.
Unfortunately, "alternative credentials" is disabled in our org, so we have to use PAT. PAT is not working, so I cant work.
Upvotes: 4
Views: 13562
Reputation: 311
if you want to avoid personalAccessTokens and have the Azure CLI installed, you can use following snippet
az login --allow-no-subscriptions --tenant $tenant
$azureDevOpsToken = az account get-access-token --resource '499b84ac-1321-427f-aa17-267ca6975798' --query accessToken --output tsv --tenant $tenant
git clone "https://[email protected]/$organization/$projectName/_git/$repositoyName"
Upvotes: 0
Reputation: 2132
git clone https://{yourPAT}@dev.azure.com/yourOrgName/yourProjectName/_git/yourRepoName
That should suffice.
Upvotes: 3
Reputation: 18387
Just click on Generate Git Credentials and use it to authenticate / clone your repo:
Upvotes: 1