1

I have an Azure DevOps Server instance installed on a Windows Server 2019 machine: https://tfs.acme.com

I'm trying to clone a repository using a personal access token. I managed to clone the repository using my NTLM login password, but not using the token (fatal: Authentication failed).

I enabled all possible scopes when generating the token and it works fine for all API calls I've tried.

devops

Is there any additional configuration for cloning with token? Another method that will allow me to use same password for both API and clone? (NTLM password fails on Rest API calls).

jessehouwing
  • 106,458
  • 22
  • 256
  • 341
Mugen
  • 8,301
  • 10
  • 62
  • 140
  • I've posted the issue also to Microsoft developers community, but I have less faith of the activity there https://developercommunity.visualstudio.com/content/problem/889868/cannot-clone-git-from-azure-devops-server-on-prem.html – Mugen Jan 19 '20 at 15:52
  • 1
    The REST API should just work using NTLM. What are you doing to pass the credential? Vice versa, Git Clone should work using a PAT, but it requires the server to allow basic auth and the server may try to negotiate to Kerberos or NTLM when the client can perform that to be more secure. – jessehouwing Jan 19 '20 at 19:01
  • Have you tried disabling the Git Credential Manager For Windows to revert to basic Git authentication on Windows? See the last part of this blog post: https://jessehouwing.net/configure-visual-studio-to-use-a-different-git-credential-manager-for-windows/ – jessehouwing Jan 19 '20 at 19:31
  • I'm cloning on Mac, not Windows. Will try to enable basic auth – Mugen Jan 19 '20 at 20:29

1 Answers1

0

This worked for me: https://learn.microsoft.com/en-us/azure/devops/organizations/accounts/use-personal-access-tokens-to-authenticate?view=azure-devops&tabs=Linux#use-a-pat

Linux:

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

Windows:

$MyPat = ':PatStringFromWebUI'
$UserName = ':UserNameToUseWithToken'
$B64Pat = [Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes("$UserName:$MyPat"))
git -c http.extraHeader="Authorization: Basic $B64Pat" clone https://dev.azure.com/yourOrgName/yourProjectName/_git/yourRepoName
willbush
  • 190
  • 4
  • 5