Getting Teamcity to use existing git repository


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?

1 comment
Comment actions Permalink


It is possible to specify a custom checkout directory for agents, see:

You can also configure agent to never cleanup this directory:

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.



Please sign in to leave a comment.