【问题标题】:How to run git push command from Azure DevOps powershell task如何从 Azure DevOps powershell 任务运行 git push 命令
【发布时间】:2019-03-30 02:39:11
【问题描述】:

我想在 Azure DevOps 中运行 PowerShell 任务。

我在 PowerShell 任务中给出了脚本路径。我已经在这个脚本文件中编写了 git 命令的执行。已从 Azure 门户执行添加和提交,但无法执行推送命令,提交后构建冻结。

【问题讨论】:

  • 可以分享一下日志吗?您使用托管代理还是私有代理?
  • 欢迎来到 StackOverflow!您是否在您控制的代理上运行它?可能是 Git 正在弹出一个 Autorization 弹出窗口……您可能需要在系统中禁用适用于 Windows 的 Git Credential Manager。 github.com/Microsoft/Git-Credential-Manager-for-Windows/issues/…
  • 我同意@hessehouwing,也许你可以作为执行构建代理的帐户远程登录服务器,如果它是私有构建代理,并查看命令是否执行成功并提示证书。每当我遇到构建问题时,我总是喜欢以构建服务帐户的身份登录我的构建服务器并以这种方式解决问题。
  • @Shayki:我正在使用私人代理,用于日志文件click here
  • @jessehouwing:我在服务器中禁用了 gcm,仍然遇到同样的问题

标签: git azure-devops azure-pipelines


【解决方案1】:

我最近在 Azure DevOPs 中配置 git 命令时遇到了这样的问题。 这就是我能够 git push 的方式

"Config Set"
git config user.email "$(Build.RequestedForEmail)"
git config  user.name "$(Build.RequestedFor)"
"Push new Branch"
git -c http.extraheader="AUTHORIZATION: bearer $(System.AccessToken)" push origin master:refs/heads/my-branch

希望这对其他人有所帮助。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-10-04
    • 2019-07-25
    • 2020-04-02
    • 1970-01-01
    • 1970-01-01
    • 2021-09-27
    • 2021-11-04
    • 2020-12-09
    相关资源
    最近更新 更多