Team City 执行 Git 脚本

Team City execute Git script

我在 Windows 上使用本地系统帐户 运行ning TeamCity (9.x)。我也在服务器上安装了 mysysgit。我想 运行 通过 TC 使用命令行构建步骤推送到 git 回购的脚本。回购是安全的,因此团队城市必须进行身份验证。我如何实现这一目标?凭据存储是针对每个用户的,因此不确定如何在本地系统上下文中存储凭据。通过 http 访问 git。

确保不要安装 obsolete msysgit, but the new Git for Windows

I want to run a script via TC using a command line build step that pushes to a git repo. The repo is secure so team city must authenticate.

您只需要使用包含用户名的 http url。

https://<username>@yourserver/<username>/<barerepo.git>

然后您可以设置一个 git 配置 credential.helper netrc,它将查找 %HOME%_netrc 文件以获取用户名和密码。
use an encrypted one,但由于 TC 无论如何都无法输入 gpg 私钥密码,您最好尝试使用 _netrc 纯文本文件。

machine yourserver
login username
password a_password
protocol https

确保将与 TeamCity 使用的相同用户帐户的全局设置设置为 运行。