Mercurial over SSH with Private Key Authentication

I'm currently trying to add a VCS root for a project on our TeamCity 5.1.3 Server running on Windows Server 2008 R2.

The VCS Root is Mercurial over SSH using Private Key authentication and I cant seem to get this to work. The Problem is that the TeamCity Web Server is configured to run under the System Account and can't find a way to tell Mercurial to use plink which is usually done through mercurial.ini residing in the users home directory. Is it even possible to use home directory relative files when a service runs under the system account?

1 comment
Comment actions Permalink

Ok I've found the solution.

My "Pull changes from" field was set like this:


There were two problem with this:

  1. The ssh URL contained the user name
  2. The path needs to contain a second / at the beginning otherwise the server will see it as "usr/local/hg/testproject"

So we end up with this:


But before it works the user name needs be entered in Teamcity's "User name:" field under "Authorization Settings" AND the mercurial.ini in the home directory of the user under which the Teamcity Web Server runs need to contain at least this:


ssh = "C:\Program Files\putty\plink.exe" -i "<absolute path to your .ppk file which needs to be stripped of a passphrase"

Please note that you need to run the Teamcity Web Server under a user account for which you know the home directory. Like I said I could not figure out where that is for the system account so I ran Teamcity under the local Administrator account. Not ideal but I've encountered some problems running Teamcity under a non priviledged user account.

To Jetbrains: Is it possible to run the Teamcity Web Server under a non priviledge user account on Windows Server?


Please sign in to leave a comment.