严重:无法读取"https://OrganizationName@dev.azure.com"的密码:终端提示已禁用 [英] Fatal: Could not read password for 'https://OrganizationName@dev.azure.com': terminal prompts disabled

查看:448
本文介绍了严重:无法读取"https://OrganizationName@dev.azure.com"的密码:终端提示已禁用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用Azure Pipelines PowerShell任务构建时,我尝试将develop分支合并到master分支.

I'm trying to merge the develop branch to the master branch when building with Azure Pipelines PowerShell task.

但是在执行命令git push时,出现此错误:

But while executing the command git push, I'm getting this error:

致命:无法读取以下用户的密码: ' https://OrganizationName@dev.azure.com ':终端提示已禁用

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

代码存储库为"Azure Repos Git".

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

在引用了一些URL之后,我创建了个人访问令牌,并将push命令修改为git push https://PAT@dev.azure.com/OrganizationName,但仍然无法正常工作.

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.

推荐答案

您提到过,您需要使用PAT,但必须采用这种方式:

As you mentioned you need to use PAT but in this way:

git push https://{PAT}@dev.azure.com/{organization}/{project}/_git/{repo-name}


另一种解决方案是在作业选项中允许脚本访问OAuth令牌":


Another solution is to "Allow scripts to access the OAuth token" in the job options:

在git push中使用System.AccessToken:

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

这篇关于严重:无法读取"https://OrganizationName@dev.azure.com"的密码:终端提示已禁用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆