On February I posted about “Running your TeamCity builds from PowerShell for any Git branch” and now I have to configure a new ssh key so that TeamCity can connect to Gitlab.

I struggled a bit getting continuous error message from TeamCity that the connection failed because it was enable to load identity file. File rights were all ok on the key file and everything looked fine. But still the error message.

Then I remembered that I had the same issue in February while using PuTTYgen to generate my SSH key pair.

I forgot a minor details that I had to generate the key pair like this:

  1. Click Generate button and move your mouse
  2. Click Save public key
  3. Click Save private key (if you need it in this format)
  4. Click on the menu Conversions / Export OpenSSH key and save that key

Then upload the exported OpenSSH key on the TeamCity server. The one in the putty format isn’t working, and that was my problem!

Finally copy the public key generated to your clipboard

and use it in Gitlab

Now when you test the Git connection from TeamCity you should see the following