Nar*_*ril 0 git azure-devops azure-pipelines
我想在来自自托管构建服务器的 Azure Devops 发布管道中从 powershell 脚本执行 git push 。
它在构建管道中工作,但从发布管道中我最终遇到身份验证错误。“允许脚本访问 OAuth 令牌”已激活,并且构建机器具有贡献权限(正如我所说,它在构建管道中工作)。
这是我在 devops protal 中看到的错误:
git : remote: 001f# service=git-receive-pack
At C:\Builds\A1\_work\r1\a\Source\Scripts\CreateTagFromPipeline.ps1:11 char:1
+ git push
+ ~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (remote: 001f# service=git-receive-pack:String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
PowerShell exited with code '1'.
Run Code Online (Sandbox Code Playgroud)
如果我通过远程桌面登录到机器并手动推送,我会得到一些更好的错误:
$ git push
remote: 001f# service=git-receive-pack
remote: 0000000000aaTF401027: You need the Git 'GenericContribute' permission to perform this action. Details: identity 'Build\58bb64d7-d065-4522-94e2-a153b9fdadd6', scope 'repository'.
remote: TF401027: You need the Git 'GenericContribute' permission to perform this action. Details: identity 'Build\58bb64d7-d065-4522-94e2-a153b9fdadd6', scope 'repository'
fatal: unable to access 'https://our-correct-repo-address-on-dev.azure.com': The requested URL returned error: 403
Run Code Online (Sandbox Code Playgroud)
同样,它适用于构建管道,但不适用于发布管道。
-- 开始编辑 -- 您需要为此身份“Build**58bb64d7-d065-4522-94e2-a153b9fdadd6**”授予通用贡献权限。
- - 编辑 - -
构建管道是否也在自托管构建服务器上运行?
转到您的构建管道 -> 变量 -> 检查 system.collectionId。
是 58bb64d7-d065-4522-94e2-a153b9fdadd6 吗?
如果这不是您的构建管道中的集合 ID,则意味着您的发布管道中的身份 58bb64d7-d065-4522-94e2-a153b9fdadd6 没有创建分支的权限。
| 归档时间: |
|
| 查看次数: |
1617 次 |
| 最近记录: |