Skip to end of metadata
Go to start of metadata
You are viewing documentation of TeamCity 6.5.x, which is not the most recent released version of TeamCity. Please refer to the listing to choose another version.
Search

Table of Contents

This page contains description of the fields and options available when setting up VCS roots using the Git Version Control System. The VCS is visible as "Git (JetBrains)" in VCS chooser to eliminate confusion with third-party plugin if third-party plugin is installed and as "Git" otherwise.

Important Notes

Icon
  • Remote run is supported in IntelliJ IDEA and Eclipse plugins, pre-tested commit is not yet supported in any of the IDE plugins.
  • Initial Git checkout may take significant time (sometimes hours), depending on the size of your project history, because the whole project history is downloaded during the initial checkout.
  • Time difference between Git repositories may cause frequent clean checkout. To avoid this, make sure to synchronize time on developers' machines with the time of Git repository TeamCity monitors. For more details, please refer to http://youtrack.jetbrains.net/issue/TW-13846.

General Settings

Option

Description

Fetch URL

The URL of the remote Git repository.

Push URL

The URL of the target remote Git repository.

Ref name

The name of the git ref (e.g. "master", "refs/tags/v5.1"), or left this field blank to use "master" branch.

Clone repository to

The path to a directory on TeamCity server where a bare repository should be created. Leave it blank to use default path.

User Name Style

Changing user name style will affect only newly collected changes. Old changes will continue to be stored with the style that was active at the time of collecting changes.

Submodules

Select whether you want to ignore the submodules, or treat them as a part of the source tree.

The following protocols are supported for the server-side checkout mode:

  • ssh: (e.g. ssh://git.somwhere.org/repos/test.git, ssh://git@git.somwhereElse.org/repos/test.git, scp-like syntax: git@git.somwhere.org:repos/test.git)

    Be Careful

    Icon

    Scp-like syntax requires a colon after hostname, while usual ssh url does not. This is a common source of errors.

  • git: (e.g. git://git.kernel.org/pub/scm/git/git.git)
  • http: (e.g. http://git.somewhere.org/projects/test.git)
  • file: (e.g. file:///c:/projects/myproject/.git)

    Be Careful

    Icon

    When you run TeamCity as a Windows service it cannot access a mapped network drives and repositories located on them.

Authentication Settings

Authentication Method

Description

Anonymous

Select this option to clone a repository with anonymous read access.

Default Private Key

Valid only for SSH protocol and applicable to both fetch and push urls. Uses mapping specified in <USER_HOME>\.ssh\config if that file exists.
Specify a valid username if there is no username in the clone URL. The username specified here overrides username from the URL.

Password

Specify username and password to be used to clone the repository. (supported only for server-side checkout)

Private Key

Valid only for SSH protocol and applicable to both fetch and push urls. (supported only for server-side checkout)

Agent Settings

Please note that agent-side checkout has limited support for SSH. The only supported authentication method is "Default Private Key".
Also you should set "StrictHostKeyChecking" to "no" in <USER_HOME>\.ssh\config, or add keys of remote hosts to the Known-Hosts database manually.
If you plan to use agent-side checkout, you need to have Git 1.6.4.0 (or higher) installed on the agents.

Supported default installation locations:

  • Windows (git.exe)
    • C:\Program Files\Git\bin
    • C:\Program Files (x86)\Git\bin
    • C:\cygwin\bin
  • Unix (git)
    • /usr/local/bin
    • /usr/bin
    • /opt/local/bin
    • /opt/bin

Option

Description

Path to git

Provide path to a git executable to be used on agent. If the path is not specified, TeamCity will use the location set up in TEAMCITY_GIT_PATH environment variable in system PATH. If this variable is not specified, a heuristic is used to detect git at the default locations.

Clean Policy/Clean Files Policy

Specify here when "git clean" command is run on agent, and which files should be removed.

Changes Checking Interval

Option

Description

Checking interval

Select here how often TeamCity should check for VCS changes. By default the global predefined server setting is used, that can be modified at the Administration > Server Configuration page. The interval's time starts being counted as soon as the last VCS server poll is finished. Here you can specify here custom interval for the current VCS root.

Icon

Some public servers can block access if polled frequently.

VCS Root Sharing

Option

Description

VCS Root Sharing

Enable this option to use this VCS root in other projects or build configurations. See Shared VCS Roots for more information.

Internal Properties

For Git VCS it is possible to configure the following internal properties:

Property

Default

Description

teamcity.git.idle.timeout.seconds

600

Idle timeout for communication with remote repository. If there are no data sent or received during this timeout - plugin will throw a timeout error (since 6.5.4)

teamcity.git.fetch.timeout

18000

Maximum time in seconds for fetch in a separate process to run. Fetch will be terminated even if teamcity.git.idle.timeout.seconds is not exceed.

teamcity.git.fetch.separate.process

true

Should TeamCity run git fetch in a separate process

teamcity.git.fetch.process.max.memory

512M

Value of JVM -Xmx parameter for separate fetch process

teamcity.git.commit.debug.info

false

Log additional debug info on each found commit

teamcity.server.git.gc.enabled

false

Whether TeamCity should run git gc during server cleanup (native git is used)

teamcity.server.git.executable.path

git

Path to native git executable on the server

teamcity.server.git.gc.quota.minutes

60

Maximum amount of time to run git gc

teamcity.git.stream.file.threshold.mb

64/128M

Threshold after which JGit uses streams to inflate objects. Defaults are 64M for clone in server process and 128M for clone in separate process.

teamcity.git.clone.timeout

18000

Timeout in seconds for transport that is used when the repository fetched first time (not used since 6.5.4)

Agent configuration for Git:

Property

Default

Description

teamcity.git.use.native.ssh

false

When checkout on agent: whether TeamCity should use native SSH implementation.

teamcity.git.use.local.mirrors

false

When checkout on agent: whether TeamCity should clone to local agent mirror first and then clone to working directory from this local mirror. This option speed-ups clean checkout, because only build working directory is cleaned. Also if single root is used in several build configurations clone will be faster.

Limitations

  • When using checkout on agent, limited subset of checkout rules is supported, because Git cannot clone a subdirectory of repository. You can only map whole repository to a specific directory using following checkout rule +:.=>subdir. The rest checkout rules are not supported.

Known Issues

  • Tagging is not supported over HTTP protocol
  • java.lang.OutOfMemoryError while fetch repository. Usually happens when there are big files in repository. By default TeamCity run fetch in a separate process, to run fetch in the server process set an internal property teamcity.git.fetch.separate.process to false.
  • Git commits are sorted by their commiter times, not their child-parent relationships. This can cause incorrect order of commits and clean checkouts on agents (e.g. TW-13846). The current workaround is to synchronize time on a machines which push to repository tracked by TeamCity.
  • Teamcity ran as a Windows service cannot access a network mapped drives, so you cannot work with git repositories located on such drives. To make this work run TeamCity using teamcity-server.bat.
  • checkout on agent using ssh protocol can be slow due to java SSH implementation (see TW-14598 for details). To use native SSH implementation set teamcity.git.use.native.ssh to true.
  • inflation using streams in JGit prevents OutOfMemoryError but can be time consuming (see related thread at jgit-dev for details and TW-14947 issue related to the problem). If you meet conditions similar to described in the issue - try to increase teamcity.git.stream.file.threshold.mb. Additionally it is recommended to increase overall amount of memory dedicated for TeamCity to prevent OutOfMemoryError.

Git support is implemented as an open-source plugin. For development links refer to the plugin's page.



See also:

Administrator's Guide: Branch Remote Run Trigger