关于 powershell:git fetch tags on Visual studio online build agent | 珊瑚贝

git fetch tags on Visual studio online build agent


我正在将 Visual Studio Online 与 Git 结合使用,并已使用在我控制的 VM 上运行的构建代理设置了持续构建。

我添加了一个 PowerShell 脚本步骤来在版本化提交上构建 msi 文件,这意味着它们有一个标签。问题是在第一步(Visual Studio)中同步存储库时不会自动获取标签。

我想我可以通过在 PowerShell 脚本的开头添加 “git fetch –tags” 来解决这个问题,但这会打印出这个错误:

1
2
3
[error]bash: /dev/tty: No such device or address
[error]error: failed to execute prompt script (exit code 1)
[error]fatal: could not read Username for ‘https://myaccount.visualstudio.com’: Invalid argument

当我设置构建代理时,它创建了一个访问令牌,但显然没有使用它,它会提示输入用户名/密码。

有人知道怎么解决吗?

  • 我找到了一种解决方案,即为代理创建用户并安装凭据管理器。不过,使用与 Visual Studio 相同的访问令牌会很好。


有 Git Build Tools,VSTS 的一个扩展,它提供了两个新的构建任务来使用 VSTS 提供的 OAuth 令牌重写远程 URL(您需要在构建定义上启用它)。使用这种方法,您不需要构建代理上的特定服务用户帐户和凭据管理器。

  • 在 VSTS 扩展中安装 Git 构建工具扩展。
  • 首先,您需要确保在构建定义选项集中有 Allow Scripts to Access OAuth Token 选项。
  • 然后,您可以添加启用 Git 远程访问任务以在代理上重写 Git 存储库的远程,以允许访问 Visual Studio Team Services 上的上游存储库。
  • 运行需要访问远程存储库的操作后,确保使用 Restore Git Remote 任务将远程恢复到其默认值。

您可以在此处找到完整的源代码,并在 wiki 中找到更多文档。


来源:https://www.codenong.com/34674290/

微信公众号
手机浏览(小程序)

Warning: get_headers(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57

Warning: get_headers(): Failed to enable crypto in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57

Warning: get_headers(https://static.shanhubei.com/qrcode/qrcode_viewid_9150.jpg): failed to open stream: operation failed in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57
0
分享到:
没有账号? 忘记密码?