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 see my id_rsa key is used in VCS root and in the Build agent.
I create a VCS Root: Type of VCS: Git, Fetch URL: ssh://email@example.com/repo_name.git, Username: git, Auth method: Uploaded key, Username: git, Uploaded key: id_rsa. It works, the repo clones well.
Futher I want to update another branch by hand, commit to it and push it. So, I create the build step: Authentification method: Uploaded key Target: github.com Username: git Select key: id_rsa Commands: git fetch ssh://firstname.lastname@example.org/repo_name.git master. Here I tried different urls, but nothing works with error:
Step 1/6: Update (SSH Exec)
Permanently added 'github.com' (RSA) to the list of known hosts.
Executing commands: git fetch ssh://email@example.com
/izdeveloper/jsoft.git watchtower on host [github.com]
Invalid command: 'git fetch ssh://firstname.lastname@example.org
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 Update (SSH Exec) failed
So, how can I pull a branch and after push it using a script? Is it possible?
If not should I use the auth via password? In this way, is there a possibility to save the password which I use in the VCS settings in a environment variable to use it in the console command of a build step?