Cannot clone git from Azure DevOps using PAT Cannot clone git from Azure DevOps using PAT git git

Cannot clone git from Azure DevOps using PAT


I have had success using PAT like this;

  1. copy clone url for your repository e.g. git clone https://<domain>.visualstudio.com/<domain>/_git/<domain>
  2. After you have copied you PAT use as;

git clone https://<PAT>@<domain>.visualstudio.com/<domain>/_git/<domain>

No Username nor password should be required as the PAT should suffice.


I've experienced the same issue, and spent quite a while searching for a solution. I finally came across this post which contained a solution in the comments section by Martinius79.

In short, it was required to pass the username and PAT, encoded as base64, through git http.extraheaders in order for it to authenticate.

100% Credit to the original author, just including it here to assist others in locating it:

Example: git -c http.extraheader="AUTHORIZATION: Basic TXlHaXRTeW5jVXNlcjo2bHFqNXJkcHEzdXBxZWVmd2o3bDduZXN5NTR3d3gxNHFobDVlanl5NTVkb2g0M3d4YzRh" clone https://tfs.address/tfs/Collection/Project/_git/RepoName

Used basic token BASE64 encoded: TXlHaXRTeW5jVXNlcjo2bHFqNXJkcHEzdXBxZWVmd2o3bDduZXN5NTR3d3gxNHFobDVlanl5NTVkb2g0M3d4YzRh

Basic Token BASE64 decoded: MyGitSyncUser:6lqj5rdpq3upqeefwj7l7nesy54wwx14qhl5ejyy55doh43wxc4a

Token is constructed from : In this example: Fictional user name: MyGitSyncUser Used PAT: 6lqj5rdpq3upqeefwj7l7nesy54wwx14qhl5ejyy55doh43wxc4a

I hope this helps!


I was having the same problem and got it solved using HTTPS only.

I figured out that I had to use the terminal only rather than using any "GUI shortcuts" dev.azure provides since they are meant for a git-credential-manager which works fine on windows but is broken for Ubuntu.

Apparently, the dev.azure git repository has a different credentials (which you need to set up) rather than your Microsoft account credential.

Let's say my Microsoft account username is johndoe@outlook.com, with its password Jd1986

This credential will NOT work if you try for git cloning, as you need to generate git credential for your project and then use it.

You can generate git credential from here,enter image description here

After this, Save it and use the set credential.enter image description here

Go to your terminal, and use the HTTP url for git clone and enter the given credential. This worked for me.