Getting Teamcity to use existing git repository

Hello,

We have a Unity project with an existing git repository (.git folder) in its directory.

We'd like to use this project directory as Teamcity's working directory - we'd also like Teamcity's built-in VCS to use the existing existing .git folder, also recognizing what commit state it's currently in.

We specifically need the VCS to recognize the state of our existing repo so that it doesn't think that it needs to do a clean + clone, since our project's git repository is massive (north of 30 GB) and is pretty much impossible to clone from scratch. Indeed at this point I don't think even a shallow clone works.

Ideally, Teamcity's VCS should see the existing .git folder, know what commit it's on, and be able to work as usual (tracking changes, fetching, etc) from that commit.

So far, I haven't had any luck setting up the VCS to this end. Is there anything I should set up specifically?

0
3 comments

Hello,

It is possible to specify a custom checkout directory for agents, see: https://www.jetbrains.com/help/teamcity/build-checkout-directory.html#Custom+checkout+directory

You can also configure agent to never cleanup this directory: https://www.jetbrains.com/help/teamcity/build-checkout-directory.html#Automatic+Checkout+Directory+Cleaning

As for the server side, you'll have to let TeamCity server itself to clone this repository to it's own caches directory. I doubt there is a workaround for it. The good news is that TeamCity 2022.04 comes with native Git support on the server side, so if you enable it, cloning and fetching will be done with the native Git executable which is likely to be faster (especially on Linux) than in previous TeamCity versions.

 

0

Is this solved? I work on a Unity project and the git repo is massive too. I want to use the existing repo on disk. Pavel Sher do you mean set VCS checkout mode to “do not checkout files automatically” with custom path? This will use the existing repo on disk but also disable branch switching funcitonality on when trigger a new build on another branch, such that I have to do branch switch mannually.

Is there any way to force teamcity not use clean checkout for the directory, while branch switching still work as expected?

0

The properties specified in https://www.jetbrains.com/help/teamcity/build-checkout-directory.html work in any case, be it manual or automatic checkout. So you can keep auto checkout mode but at the same time specify teamcity.agent.build.checkoutDir.expireHours=never in the agent buildAgent.properties file.

0

Please sign in to leave a comment.