Reputation: 355
I use a TeamCity build agent to build code. When I built it I change a file, commit it and want to push it back. I don't want to use my password in the Build Step's command line. So, I use the SSH Exec runner type. I made a key, uploaded the public one to github and the private one to TeamCity. I create the build step: Authentification method: Uploaded key Target: github.com Username: git Select key: id_rsa Commands: git fetch origin master
And I get such error:
Permanently added 'github.com' (RSA) to the list of known hosts.
Executing commands:
eval “$(ssh-agent -s)”
on host [github.com]
Invalid command: 'git fetch origin master'
You appear to be using ssh to clone a git:// URL.
Make sure your core.gitProxy config option and the
GIT_PROXY_COMMAND environment variable are NOT set.
SSH exit-code 1
Step checkout watchtower (SSH Exec) failed
I tried different commands, for example 'eval “$(ssh-agent -s)”', result is the same. So, how can I fetch or push to github from the TeamCity agent?
Upvotes: 1
Views: 1371
Reputation: 355
The issues was in ssh auth error on the agent. When I copied rsa keys to /root/.ssh I could do in a "Command line" build step: git clone -b test ssh://[email protected]/repo_name.git test The root acount is used by the agent. I don't know why TeamCity doesn't use keys which I provied it in the build settings.
Upvotes: 1
Reputation: 1323175
If, as commented, you are using a git://
URL, but cannot change it easily, you still can, on the TeamCity agent, add a:
git config --global [email protected]:.insteadOf git://github.com/
Without having to modify your URLs, TeamCity would use SSH URL instead of git://
ones.
Upvotes: 0