Git Push to Teamcity CI
(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 开发者_StackOverflowa remote repository that can be pushed to, and will trigger builds when it is.
Thanks for your help,
Paul
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.
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.
精彩评论