git checkout error on agent, works on server

Hi all,

I've trying to get TeamCity to checkout out from our git repo on the agent (I need the .git directory) and I get the following error:

[14:06:48]: Updating sources: agent side checkout...
[14:06:49]: [Updating sources: agent side checkout...] Failed  to perform checkout on agent: '"C:\Program Files (x86)\Git\bin\git.exe"  fetch --progress origin +refs/heads/master:refs/heads/master' command  failed. stderr: java.io.IOException: Authentication failed      at org.jetbrains.git4idea.ssh.SSHMain.authenticate(SSHMain.java:274)      at org.jetbrains.git4idea.ssh.SSHMain.start(SSHMain.java:158)      at org.jetbrains.git4idea.ssh.SSHMain.main(SSHMain.java:138) fatal: The remote end hung up unexpectedly


I'm using a private key and set the user name and password, when I do this as a server checkout it all works fine, does anyone have any idea what could be going out?

7 comments

Michael,

Usually this error happens when build agent runs under different user account, and doesn't have SSH keys in its profile.

0

I added the user name and path to the key to the authentication settings of the VCS screen and this is the error I get, is there something else I need to do?

0

Hi Michael,

we support only Anonymous and Default Private Key authentication modes with agent-side checkout. Could you please describe how do you specify password there?

0

we support only Anonymous and Default Private Key authentication modes with agent-side checkout. Could you please describe how do you specify password there?

Ah that probably explains why it doesn't work then... I've set the key and user in Administration >> Edit Build Configuration >> Edit VCS Root. It doesn't mention anything on that screen about it being unsupported in Agent mode (although admittedly I haven't looked in the help).

TeamCity is currently running as the system user (on windows), how do I set the default private key for this user?

0

I think procedure is the same for all users: to set up default private key on the agent, put your keys into $USER_HOME/.ssh dir. Typically $USER_HOME/.ssh contains id_rsa and id_rsa.pub files.

0

I've finally got it to work! Turns out the correct place to put the ssh keys is C:\.ssh, thanks for your help.

0

Hi Michael,

I think I have an explanation on why putting config at "c:\.ssh" did help you. I found following bugs for jvm

http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4787931
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6519127

They say that sometimes jvm returns incorrect user home dir. JVM takes value of parameter "Desktop" in the "HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders" entry in the registry, strip one dir from the end, and returns resulting value as a user home dir.

So if you will setup TeamCity on a different machine it is worth checking this registry entry to understand where you should put configs.

0

Please sign in to leave a comment.