Mercurial SSH with TeamCity on Ubuntu

When running TeamCity in docker, I recently had to setup ssh with Mercurial on which isn’t built in to TeamCity.

This is so I don’t forgot how I did it! Ideally you could do this with your own container – which is a better option!

  • SSH to the TeamCity Server
  • Type sudo docker ps
  • Type sudo docker exec -it xxx (your container id) /bin/bash
  • Type apt-get install vim
  • Type cd ~/.ssh
  • Type touch teamcity
  • Type vim teamcity
  • Add the private ssh key – using the Open-SSH key format – that you want to communicate with Mercurial – you should add the public key to
  • Save the file
  • Type touch config
    Add the following:
    IdentityFile ~/.ssh/teamcity
  • Save the file
  • Type chmod 400 ~/.ssh/teamcity
  • Type ssh
  • Accept the thumbprint – you should see that you can connect
  • Type exit

You should be able to connect via ssh to your Mercurial repository from TeamCity now!

TeamCity should have the following in the
Pull Changes From url: ssh://
Username: hg

Leave a Reply

Your email address will not be published. Required fields are marked *