I am trying to run a subprocess command to do a git pull
.
The cwd of the Git repository is /home/ubuntu/Ingest
.
The id_rsa
that I'm using with Github is located at /home/ubuntu/.ssh/id_rsa
.
How would I run a subprocess call to do the following?
import shlex, subprocess
subprocess.call(shlex.split('git pull origin master'), cwd='/home/ubuntu/Ingest')
The log looks like:
movies_ec2.py:43@__init__ [INFO] Version not up to date...Doing a git pull and exiting...
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
The script is running from cron
and is not picking up on the id_rsa
. (Note: I am not looking to use GitPython). What do I need to change in my cron job or script so that this will work? My cron job is currently:
# sudo crontab -e
*/1 * * * * STAGE=production /home/ubuntu/Ingest/ingest/movies_ec2.py > /home/ubuntu/test.log 2>&1