Slowacki Slowacki - 1 month ago 14
Git Question

How to work with multiple remote Git repositories in TeamCity?

There's a project that can be built from two remote Git repositories, TeamCity is used as the build server. One remote repository will be removed after some time, but for now we're slowly transitioning and would like to be able to see and build branches that are present on both of the remote repositories.

At first, I thought that managing the VCS roots is the way to go, but after I added the second repository as one, TeamCity still pulled the branches only from the first repository and then tried to check it out from both. So I guess, that's not the proper way to handle this.

Ideally, I would like to have something like the current dropdown in TeamCity, so:

  • default branch

  • feature/x

  • master

but instead, be able to choose the branches present on other remote repository as well. Something like:

  • default branch

  • remote_2/develop

  • remote_1/feature/x

  • remote_2/feature/y

  • remote_1/master

  • remote_2/master

Is this even possible to achieve with TeamCity without copying the build configurations?


Instead of copying you should create a build configuration template out of your configuration and then inherit from it two times, once for each repository root. This way you can maintain the configuration at one place affecting both configurations.

But yes, I think that is the only way. At least as far as I know.

Then sense in adding multiple VCS roots to one configuration is, if your software is split up in multiple repos, e. g. one per module, that you can pull them all in for the build.