Icon

You are viewing the documentation of TeamCity 9.x, which is not the most recently released version of TeamCity.
View this page in TeamCity 2018.x documentation or refer to the listing to choose the documentation corresponding to your TeamCity version.

 
Skip to end of metadata
Go to start of metadata

The SSH Agent build feature, available since TeamCity 9.1, runs an SSH agent with the selected uploaded SSH key during a build. When your build script runs an SSH client, it uses the SSH agent with the loaded key.

Supported Key Format

TeamCity supports keys in the OpenSSH format only. If your private key uses a different format, it has to be converted to the OpenSSH.


(info) For example, the Putty private key format (*.ppk) not supported by TeamCity can be converted to the OpenSSH format using PuTTY Key Generator: use the menu  Conversions  -> Export OpenSSH key.

Setup Notes

TeamCity SSH Agent uses a native ssh agent from the OpenSSH included with Linux and Mac OS X, so the feature works out of the box for these OS's. For Windows, OpenSSH needs to be installed (e.g. as a part of CygWin, MinGW or a part of Git distribution for Windows).

The SSH agent must be added to $PATH on Unix-like OS's and to %PATH% on Windows.

For each TeamCity build agent a separate ssh agent is started,so it is possible to use this feature if several build agents are installed on the same machine.

Disabling SSH host key checking

The first time you connect to a remote host, the SSH client asks if you want to add a remote host's fingerprint to the known hosts database at ~/.ssh/known_hosts.

To avoid such prompts during a build, you need to configure the known hosts database beforehand. If you trust the hosts you are connecting to, you can disable known hosts checks:

  • either for all connections by adding something like this in ~/.ssh/config:

  • or for an individual command by running an ssh client with the -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no options.

See more information in the man pages for sshssh-agent and ssh-add commands.

 

  • No labels

7 Comments

  1. Is this feature available also on Windows? Does it add any requirements to agent? Thanks!

  2. I'd like to add more than one ssh key. Do you think this can be implemented? Thank you.

    1. +1

      Required for Capistrano+PHP+Composer with private repos

       

      Thank you

       

  3. Please, be careful to use openssh compatible keys. You can use as an uploaded key private key in putty format and test connection will say it's OK, server side checkout will work too, but on agent it will not work neither for agent checkout nor SSH Agent.

    And second, for windows only - add in PATH '%ProgramFiles%\Git\usr\bin' for https://git-for-windows.github.io

    I didn't notice it and even opened https://teamcity-support.jetbrains.com/hc/en-us/requests/670848

    Your Captain Obvious (smile)

    1. Sergio Rykov, Thanks for your comment. I've added the Supported Key info to this page as well.