Running shell script to do git push w/ ssh key, Permission denied

Hi,

I'm trying to set up TeamCity to run a shell script that pushes everythin to my test server.

The build process looks like this:

- Fetch all code from GitHub.
- Run UnitTests and build
- Shell script to push to test server (amazon ec2) using git

The problem here is that the shell script isn't allowed to push to the test server, when it's run by TC.

I get "Permission denied (publickey)."

I had the same problem when running the script from a shell but got it working by adding the key to my user (same user that runs TC) with ssh-add.

So I can run the script manually, but would like to get TC to run it.

Anyone know if there's a differance running shell script from TC or in a shell on the server?

..fredrik

1 comment
Comment actions Permalink

ssh-add works for a single user session, and build agent cannot access that ssh agent.
I see two options

  1. Launch the build agent interactivelly within your user session. Drawback: you have to do it manually after each system restart.
  2. Use a private key without passphrase. Drawback: you'll need to secure access to this computer.


Michael

0

Please sign in to leave a comment.