Not sure if this is a duplicate question but I really can't find any solution to my problem.
The problem is that I can't run the following command.
#!/bin/bash
SCRIPT1="cd /path/to/project;"
SCRIPT2="git pull;"
ssh "production" ${SCRIPT1} "ssh-agent /bin/bash; ssh-add ~/.ssh/my_bitbucket_key;" ${SCRIPT2}
Still a newbie in bash and ssh so I am not sure also if this is the correct way of doing this.
Hope you can help me. Thanks!
#!/bin/bash -vxto see variable substitutions as they happen in each cmd. I think you'll see the problem. Don't be confused that all strings are now single quoted on the lines beginning with+. That's just the way the debugger "normalizes" its inputs. Good luck.prod "cd /path/to/project; git pullwhereprodcould be something likeprod () { ssh production ssh-agent bash -c "ssh-add ~/.ssh/my_bitbucket_key; $@"; }