TeamCity Cloud 2023.09 Help

VCS Checkout Mode

The Version Control Settings page of a build configuration allows configuring how project source code is retrieved from VCS: you can attach a VCS root and configure checkout options.

The VCS Checkout mode is a setting that affects how project sources reach an agent. This mode affects only sources checkout. The current revision and changes data retrieving logic is executed by the TeamCity server, and thus TeamCity server needs to access the VCS server in any mode.

Depending on the version control used, agents can require command line clients installed and available in PATH on the agents (for example, Perforce, Git, Mercurial).

The checkout mode is configured on the build configuration's Version Control Settings page, in the Checkout Settings section (advanced settings).

TeamCity has the following VCS checkout modes:

Checkout mode

Description

Prefer to check out files on agent

This is the default setting for the newly created build configurations. When upgrading, the checkout mode settings for existing build configurations are preserved.

With this setting enabled, TeamCity will use the agent-side checkout (see the "Always checkout files on agent" mode below) if possible. If the agent-side checkout is not possible, TeamCity will display a corresponding health report item and will use the server-side checkout (see the "Always checkout files on server" mode below).

TeamCity falls back to the server-side checkout in the following cases:

  • No Git or Mercurial client is found on the agent.

  • The Git or Mercurial client is present on the agent, but is of the wrong version.

  • Perforce:

    • If Perforce client cannot be found on the agent.

    • If a stream depot is used and the checkout rules are non-trivial (other than . => A). To disable the fallback in this case, you can enable the Create non-stream workspace option in the Perforce root settings. Note that it will prevent commits to streams during the build.

Always check out files on server

The TeamCity server will export the sources and pass them to an agent before each build. Since the sources are exported rather than checked out, no administrative data is stored in the agent's file system and version control operations (like check-in, label or update) cannot be performed from the agent. TeamCity optimizes communications with the VCS servers by caching the sources and retrieving from the VCS server only the necessary changes. Unless clean checkout is performed, the server sends to the agent incremental patches to update only the files changed since the last build on the agent in the given checkout directory.

Always check out files on agent

The build agent will check out the sources before the build. Agent-side checkout frees more server resources and provides the ability to access version-control-specific directories (.svn, CVS, .git); that is, the build script can perform VCS operations (for example, check-ins into the version control) — in this case ensure the build script uses credentials necessary for the check-in.

VCS client software has to be installed on the agent (applicable to Perforce, Mercurial, Git).

Do not check out files automatically

TeamCity will not check out any sources automatically, the default build checkout directory will still be created so that you could use it to check out the sources via a build script. Note that TeamCity will accurately report changes only if the checkout is performed on the revision specified by the build.vcs.number.* properties passed into the build.

The build checkout directory will not be cleaned automatically, unless the directory expiration period is configured.

Last modified: 08 February 2022