Git Vcs Root
Git VCS root
Example. Defines a VCS root MyVcsRoot with authentication by an SSH key and registers it in the project and a build configuration.
project {
...
vcsRoot(MyVcsRoot)
buildType{
id = "MyBuild"
name = "MyBuild"
vcs {
root(MyVcsRoot)
}
...
}
...
}
object MyVcsRoot: GitVcsRoot({
name = "My project main repository"
url = "<repository URL>"
branch = "refs/heads/main"
checkoutPolicy = AgentCheckoutPolicy.USE_MIRRORS
authMethod = uploadedKey {
uploadedKey = "<SSH key name>"
}
})
Types
Policy for checking out sources on agent
Specifies flags for the "git clean" command during agent-side checkout and defines which files will be removed.
Specifies when the "git clean" command should be executed in case of agent-side checkout
Submodules checkout mode
Defines how TeamCity retrieves VCS username from git commit. When the git config contains the following
Properties
Specifies which files should be removed when "git clean" command is executed during agent-side checkout.
Specifies when the "git clean" command should be executed in case of agent-side checkout
Custom path to git executable on the build agent machine
VCS Root authentication method
Branch specification to use in VCS root
Policy for checking out sources on agent
Whether VCS root should include changes in submodules and check their sources for build. By default submodules are checked out.
VCS root id. It appears in the web UI and is used in urls. If the VCS root has a uuid specified, then the id can be changed at any time. If uuid is omitted, then TeamCity treats a VCS root with a changed id as a new VCS root, all data associated with the old root will be lost (e.g. a commits graph). Id can also be used by some settings, e.g. as a part of parameter reference. If you change the id, you should find all its occurrences in the current project and change them too. Id must be unique across all VCS roots on the server. If id is missing, it will be generated from the class name (if the class is not from the jetbrains.buildServer.configs.kotlin
package).
Helper for creating references to parameters of this VCS root
VCS root polling interval, in seconds
Whether TeamCity should convert line-endings of all text files to CRLF during server-side checkout. By default false.
When this option is enabled, TeamCity creates a separate clone of the repository on each agent and uses it in the checkout directory via git alternates. This make agent-side checkout faster. By default true.
A username for tag/merge operations in this VCS root. Format: Username
Defines how TeamCity retrieves VCS username from git commit.
When enabled tags matched by branch specification will be shown in UI as regular branches. By default false.
Functions
Anonymous repository access
Copies parameters of this object to the specified target
SSH key on the specified path. Supported only for server-side checkout. Switch to uploaded SSH key if you want to use an agent-side checkout.
Default SSH key found on the machine. If you use an agent-side checkout, then this key should also be available on the build agent machines. Often it is easier to use the uploaded SSH key.
Sets the id to the specified value. Type of the id depends on the context in which DSL is executed: it is RelativeId when DSL context is relative, otherwise it is AbsoluteId.
Password authentication
Authentication with a refreshable token stored in TeamCity token storage
Uploaded SSH key with the specified name.
Validates this object and reports found errors to the provided consumer