致命:无法读取 'https://OrganizationName@dev.azure.com' 的密码:终端提示已禁用
Fatal: Could not read password for 'https://OrganizationName@dev.azure.com': terminal prompts disabled
我试图在使用 Azure Pipelines PowerShell 任务构建时将 develop
分支合并到 master
分支。
但是在执行命令 git push
时,出现此错误:
Fatal: Could not read password for
'https://OrganizationName@dev.azure.com': terminal prompts disabled
代码存储库是 "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 后,我创建了个人访问令牌,并将推送命令修改为 git push https://PAT@dev.azure.com/OrganizationName
,但仍然无法正常工作。
如果您找到解决此问题的方法,请告诉我。
正如您提到的,您需要使用 PAT,但使用这种方式:
git push https://{PAT}@dev.azure.com/{organization}/{project}/_git/{repo-name}
另一种解决方法是在作业选项中"Allow scripts to access the OAuth token":
在 git 推送中使用 System.AccessToken:
git push https://$env:SYSTEM_ACCESSTOKEN@dev.azure.com/......
并向构建用户授予推送权限(在回购设置中):
类似于,但如果您不是运行 powershell 任务,请使用:
git push https://$(System.AccessToken)@dev.azure.com/......
我特别在用
- 经典管道
- onprem Windows 构建代理
- 代理作业设置已启用允许脚本访问 OAuth 令牌
- 命令行任务
删除 C:\program files\Git\dev\fd 然后重新安装 Microsoft git.
我试图在使用 Azure Pipelines PowerShell 任务构建时将 develop
分支合并到 master
分支。
但是在执行命令 git push
时,出现此错误:
Fatal: Could not read password for 'https://OrganizationName@dev.azure.com': terminal prompts disabled
代码存储库是 "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 后,我创建了个人访问令牌,并将推送命令修改为 git push https://PAT@dev.azure.com/OrganizationName
,但仍然无法正常工作。
如果您找到解决此问题的方法,请告诉我。
正如您提到的,您需要使用 PAT,但使用这种方式:
git push https://{PAT}@dev.azure.com/{organization}/{project}/_git/{repo-name}
另一种解决方法是在作业选项中"Allow scripts to access the OAuth token":
在 git 推送中使用 System.AccessToken:
git push https://$env:SYSTEM_ACCESSTOKEN@dev.azure.com/......
并向构建用户授予推送权限(在回购设置中):
类似于
git push https://$(System.AccessToken)@dev.azure.com/......
我特别在用
- 经典管道
- onprem Windows 构建代理
- 代理作业设置已启用允许脚本访问 OAuth 令牌
- 命令行任务
删除 C:\program files\Git\dev\fd 然后重新安装 Microsoft git.