TeamCity agent error "failed to perform checkout on agent"
Asked Answered
C

2

14

I am running my TeamCity 7 server and agent on MacOS. My repo is on github. I use ssh and I know that the authentication is correctly configured, because the test is successful.

The build works fine when I use VCS Checkout Mode "Automatically on server", however when I use VCS Checkout mode "Automatically on agent" I get this error.

[13:40:35][Updating sources] Failed to perform checkout on agent: '/usr/bin/git fetch --progress origin +refs/heads/master:refs/remotes/origin/master' command failed.
stderr: java.io.IOException: Authentication failed
    at org.jetbrains.git4idea.ssh.SSHMain.authenticate(SSHMain.java:275)
    at org.jetbrains.git4idea.ssh.SSHMain.start(SSHMain.java:159)
    at org.jetbrains.git4idea.ssh.SSHMain.main(SSHMain.java:139)
fatal: The remote end hung up unexpectedly

What am I missing?

Cousins answered 31/5, 2012 at 20:48 Comment(3)
Do you have correct ssh key on th agent? "Test connection" in VCS root settings tests connection only between TeamCity server and your repository.Purism
I guess I don't, but how do I figure out the account of the agent? Can I change the account under which the agent works?Cousins
Account of the agent is the account under which the agent was started. So yes you can change that.Purism
D
30

Try adding teamcity.git.use.native.ssh=true as a config parameter into your build configuration.

It is what helped me solve a similar problem. I learned this trick from here.

Dray answered 21/2, 2013 at 0:0 Comment(3)
This hint fixed it for me as well.Paulita
This link might also be useful if you have Putty SSH keys (see comment thread)Barocchio
This fixed it for me even though my build log said nothing at all about authentication failure!Trumpet
A
2

What was not at all obvious to me is that the Default Private Key on the server is copied to the agent and used there. I tried first in vain to add the private key to the user the agent was running as (obviously on the agent machine). But then I added the private key to the user that was running TeamCity on the server machine, and then the Agent Side checkout started working.

I also used the teamcity.git.use.native.ssh=true property, but I don't think it helped with this particular problem.

The only trace of this information was in this comment.

Angelikaangelina answered 22/11, 2013 at 9:38 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.