Reputation: 3
I'm unable to clone my Azure devOps repo inside my Build Agent server/pool. However, cloning using Github repo works fine.
Error: "fatal: could not read username for 'https://devops.azure.com': Terminal prompts disabled"
Generated PAT in ADO, and run git clone https://[email protected]/Org
and
Enabled "Allow script to access the Oauth Token"
Upvotes: 0
Views: 229
Reputation: 35504
To solve this issue, you can consider adding config parameters in the git clone command:
For example:
Windows:
$MyPat = 'yourPAT'
$B64Pat = [Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes("`:$MyPat"))
git -c http.extraHeader="Authorization: Basic $B64Pat" clone https://dev.azure.com/yourOrgName/yourProjectName/_git/yourRepoName
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
On the other hand, if you are using the system.accesstoken variable for authentication, you can try to use the following commnad:
git clone -c http.extraheader="AUTHORIZATION: bearer $(System.AccessToken)" https://dev.azure.com/yourOrgName/yourProjectName/_git/yourRepoName
Upvotes: 0