Getting Continua to work with a Git repository over SSH takes a couple of additional steps.

Step 1. Ensure git is installed and setup

I've chosen to use the official Git for Windows package found at http://git-scm.com/download/win

Install git on the machine the Continua server runs on. Once git is installed, setup a user name and email address for the git user.

git config --global user.name "Your Name"

git config --global user.email you@email.com

Step 2. Set environment variable

When the SSH tools are used by Git executable, it will use the value in the HOME environment variable which contains the path to the SSH settings to be used by Git. You can set an environment variable by right-clicking My Computer/Computer in your start-menu then selecting Properties. Click the Advanced system settings heading and you should see this dialog:

















Click Environment Variables.
















Make sure you are logged in as the same user the Continua server is run under. Click the New button in the section for User variables







Enter HOME for the Variable name and %USERPROFILE% for the Variable value.

Once the variable is created, you MUST restart the Continua CI Server service otherwise it won't detect the new environment variable you just created. If this happens, Continua CI will hang waiting on input from the user. You need to kill the processes plink.exe and ssh.exe then stop the Continua CI Server service.

Step 3. Generate SSH Keys

Navigate to the directory Git was installed to, by default it's C:\Program Files (x86)\Git, go into the \usr\bin directory and look for the executable ssh-keygen.exe.

Run the command:

ssh-keygen -C "youremail@domain.com" -t rsa

This command generates a private key file id_rsa and a public key file id_rsa.pub in the %USERPROFILE%/.ssh directory. In order to get a password-less SSH session happening between the Continua CI server and the SSH server, we need to make sure the SSH server has the Continua CI server's public key in its authorized_keys file. You only want to add the public key to the authorized_key file that belongs to the user the Continua CI server will be logging in as. Log into the SSH server and add the contents of id_rsa.pub to the authorized_keys file. You can find it in /home/name_of_user_continua_will_login_as/.ssh/. If the file doesn't exist, create it.

Step 4. Cache key and validate settings

The final step is to cache the key in the registry. To do this, run the Git command:

git ls-remote user@ssh_host:/path/to/git/repo

It should prompt you for a yes/no confirmation, type yes and hit enter. Make sure it was able to connect you to the repository and gave you the correct response.

If you're prompted for a password, then something went wrong with the private/public key setup.


  • No labels