I have the following shell script
#!/bin/bash
REPODIR=$HOME/work/repository/
cd $REPODIR
var=`git fetch --dry-run 2>&1`
echo $var > $HOME/error.txt
I want to run my script every minute, so I edit crontab (via crontab -e
) in order to run script from the current user.
*/1 * * * * /home/nameoftheuser/Documents/report-server.sh
From manual run - script works correctly. But running script from crontab (in the error.txt):
fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists.
Script file has 775 rights. I'm also checked git status
and git config -l
and that commands work correctly. git config -l
correctly display remote origin url. Ubuntu 13.04 x64 with latest updates.
What should I do to work with git from crontab?