Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Make TeamCity pull down all git branches

Tags:

git

teamcity

On the builds server I have set up TeamCity (8.1.1) so that it executes the build process if there are changes in either the master, one of the feature branches or one of the pull request branches using the branch specifier:

+:refs/heads/*
+:refs/pull/(*/merge)

I have turned on the build agent option:

teamcity.git.use.local.mirrors=true

which clones the repository in a directory outside the build directory and then pulls from that local repository.

The build process needs access to the git repository and the master branch, even for builds of one of the feature branches or pull request branches. However TeamCity only has the branch that contains the changes in the local repository thereby making my builds fail, e.g. when the change was on the issue/mycoolissue branch then that is the only branch that exists in the git repository in the TeamCity working space.

I have tried performing a local git fetch to get the master branch but because the local repository does not have the master branch this fails. While I could add a remote pointing to the origin (a github private repository) that would mean that I'd have to handle credentials as well and I'd rather have TeamCity take care of all of that for me.

My question is whether there is a way to tell TeamCity to just pull all the branches into both the local repository and the working repository?

like image 789
Petrik Avatar asked May 19 '14 09:05

Petrik


People also ask

Does git pull pull all branches?

git pull fetches updates for all local branches, which track remote branches, and then merges the current branch.


1 Answers

Starting from TeamCity 10.0.4, you can do that by adding a configuration parameter teamcity.git.fetchAllHeads=true See here

like image 156
DixonD Avatar answered Sep 30 '22 09:09

DixonD