When running TeamCity in docker, I recently had to setup ssh with Mercurial on Bitbucket.org 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 Bitbucket.org.
- Save the file
- Type touch config
Add the following:
Host bitbucket.org
IdentityFile ~/.ssh/teamcity
- Save the file
- Type chmod 400 ~/.ssh/teamcity
- Type ssh hg@bitbucket.org
- 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://bitbucket.org/repository
Username: hg
Password: