0
votes

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:

https://docs.microsoft.com/en-us/azure/devops/organizations/accounts/use-personal-access-tokens-to-authenticate?view=azure-devops

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.

2
Try: . as user and your PAT as password.jessehouwing
thanks jessehouwing, but "." didnt work unfortunately.John Little
https://asdf:{myPATgoesHERE}@dev.azure.com/ourorg.visualstudio.com/CMS/_git/ourProj shouldn't contain .visualstudio.com.jessehouwing
https://<PAT>@username.visualstudio.com/myrepos/_git/myprojectuser1912383

2 Answers

1
votes

Just click on Generate Git Credentials and use it to authenticate / clone your repo:

enter image description here

1
votes
git clone https://{yourPAT}@dev.azure.com/yourOrgName/yourProjectName/_git/yourRepoName

That should suffice.