Git 推送到 Teamcity CI

发布于 2024-10-03 00:26:10 字数 292 浏览 0 评论 0原文

(使用 .net、TeamCity、git)

要使用 git 创建我们的团队可以推送到的存储库,它需要是 --bare。这适用于源代码控制。

然而,这个 --bare 存储库将被监控以使用 TeamCity 触发 CI 构建。我的问题是,由于裸存储库中没有代码 (.sln),如何使用此存储库来触发构建?

我已经尝试了几种配置,但是我无法创建可以推送到的远程存储库,并且在创建时会触发构建。

谢谢你的帮助,

保罗

(using .net, TeamCity, git)

To create a repository with git that our team can push to, it needs to be --bare. This works for source control.

However this --bare repository is the one that will be monitored to trigger CI builds using TeamCity. The question I have is how can I use this repository to trigger builds because there is no code (.sln) in a bare repository?

I have tried several configurations, but I can not create a remote repository that can be pushed to, and will trigger builds when it is.

Thanks for your help,

Paul

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

无所的.畏惧 2024-10-10 00:26:10

2012 年 1 月更新:

Jon 在评论中提到 TeamCity 版本 6.5.6 对 Git 有很好的集成,这将使我在下面建议的挂钩不再需要。

例如,它包括:

Git 和 Mercurial 分支上的个人构建

TeamCity 6.5 提供了一种更自然的方式来通过分布式版本控制在服务器上启动个人构建。

personal build change


原始答案 2010 年 11 月

您可以设置两个存储库:

  • 一个是裸存储库,您的团队将在其中引入
  • 一个非裸

存储库裸露的,添加一个更新后挂钩,它将:

  • 转到非裸存储库
  • 制作拉

取更新后钩子:

#!/bin/sh
cd /path/to/non-bare/repo &&
unset GIT_DIR
git fetch origin
git reset --hard origin/master

本文建议另一种方法(非在接收后挂钩上使用 checkout -f 的裸存储库)

总体思路仍然是更新非裸存储库,以便您的 TeamCity 实例能够处理该组文件。

Update January 2012:

Jon mentions in the comments that TeamCity version 6.5.6 has great intergration for Git, which would render the hooks I suggests below not needed.

It includes for instance:

Personal Builds on branches for Git and Mercurial

TeamCity 6.5 provides a more natural way to start Personal Builds on server with distributed version controls.

personal build change


Original answer November 2010

You can setup two repositories:

  • one bare, where your team ushes to
  • one non-bare

On the bare one, add a post-update hook which will:

  • go to the non-bare repo
  • make a pull

post-update hook:

#!/bin/sh
cd /path/to/non-bare/repo &&
unset GIT_DIR
git fetch origin
git reset --hard origin/master

This article suggests another approach (non-bare repo with a checkout -f on a post-receive hook)

The general idea remains to update a non-bare repo, in order for your TeamCity instance to work on that set of files.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文