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
I've seen this stack overflow answer: https://stackoverflow.com/questions/37971867/team-city-git-host-key-verification-failed?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa
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.
Please sign in to leave a comment.
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.
my version: TeamCity Enterprise 2017.2.3