I have been trying using crontab to automatically run a bash script that pushes changes into github. When I run the script in the shell command line, it works perfectly. But it isn´t working with crontab.
This is my crontab file (it is executing every 2 minutes because of testing purposes):
*/2 * * * * ./script.sh
This is my script:
#!/bin/bash
cd /path/to/repo.git
git push origin
Because of testing purposes I removed the passphrase for the ssh key for the connection with github
Try
$ git push -q origin
That is, assuming that git
is in a standard directory. Otherwise, add the whole path. Also, check the output in /var/log/syslog
.
add the full path to your script in
*/2 * * * * ./script.sh
and add a touch /tmp/my-check-file
to the script, to see if it actually runs.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.