问题
I'm trying to merge the develop
branch to the master
branch when building with Azure Pipelines PowerShell task.
But while executing the command git push
, I'm getting this error:
Fatal: Could not read password for 'https://OrganizationName@dev.azure.com': terminal prompts disabled
The code repository is "Azure Repos Git".
git checkout -b master
git config --global user.email "xxxxxxx@xxxx.xxx"
git config --global user.name "xxxxx"
git merge origin/develop
git push origin master
After referring some URLs, I've created the Personal Access Token, and modified the push command as git push https://PAT@dev.azure.com/OrganizationName
, but it's still not working.
Please let me know, if you find a solution for this issue.
回答1:
As you mentioned you need to use PAT but in this way:
git push https://{PAT}@dev.azure.com/{organization}/{project}/_git/{repo-name}
Another solution is to "Allow scripts to access the OAuth token" in the job options:
In the git push use the System.AccessToken:
git push https://$env:SYSTEM_ACCESSTOKEN@dev.azure.com/......
And give push permissions to the build user (in the repo settings):
回答2:
Please read git-credential-cache.
The point of this helper is to reduce the number of times you must type your username or password. For example:
$ git config credential.helper cache $ git push http://example.com/repo.git Username: <type your username> Password: <type your password>
[Work for 5 more minutes]
$ git push http://example.com/repo.git
[Your credentials are used automatically]
来源:https://stackoverflow.com/questions/56733922/fatal-could-not-read-password-for-https-organizationnamedev-azure-com-ter