Cannot clone git from Azure DevOps using PAT

后端 未结 8 1744
礼貌的吻别
礼貌的吻别 2020-12-15 07:11

I cannot clone a simple repository from Azure DevOps. OS: Ubuntu 18.10

I do this:

  • Got to Azure DevOps
  • Click on the top right corner on my use
8条回答
  •  既然无缘
    2020-12-15 07:44

    This official guide procedure worked for me, but with one important point. When base64-encoding, one must put attention to non-printable characters.

    The guide says:

    MY_PAT=yourPAT      # replace "yourPAT" with your actual PAT
    B64_PAT=$(printf ":$MY_PAT" | base64)
    git -c http.extraHeader="Authorization: Basic ${B64_PAT}" clone 
    https://dev.azure.com/yourOrgName/yourProjectName/_git/yourRepoName
    

    Using "echo" instead of "printf" would insert a newline char, changing the base64 string (probably would work also with "echo -n" but I haven't tried). Also, do not include the username, as per the snippet above.

    Used git 2.17.1 on Ubuntu 18.04.

提交回复
热议问题