Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.3k views
in Technique[技术] by (71.8m points)

git - Fatal: Could not read password for 'https://OrganizationName@dev.azure.com': terminal prompts disabled

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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:

photo

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):

enter image description here


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...