Unable to clone a private github repo using ssh inside a command line build step

I have both tried using the ssh-agent feature and manually starting an ssh-agent and then adding my private key to it. I always get this error:

[02:00:26][Step 2/4] Host key verification failed.
[02:00:26][Step 2/4] fatal: Could not read from remote repository.
[02:00:26][Step 2/4]
[02:00:26][Step 2/4] Please make sure you have the correct access rights
[02:00:26][Step 2/4] and the repository exists.
 
I also tried: mkdir -p ~/.ssh && touch ~/.ssh/known_hosts && ssh-keygen -R github.com
and I always get: do_known_hosts: hostkeys_foreach failed: No such file or directory
 
 
Which tells me I'm most likely running my TeamCity job under a "System" account and should be running it under a "user" account. I have no idea what that means or how to go about it.
1
2 comments

Which version of teamcity are you using?

Also, the "System" account is an issue on windows machines, where there is an account called "System", under which the TeamCity services can be installed by default. In your environment it doesn't work, although you still need to make sure that the user that runs the services has proper access to the .ssh folder.

0
Avatar
Permanently deleted user

my version: TeamCity Enterprise 2017.2.3

0

Please sign in to leave a comment.