0

I have a cron and when it runs in the e-mail it states /bin/bash: git command not found

git works fine via terminal but how can I add it to /bin/bash?

1
  • 1
    Have you had a look at the excellent crontab tag wiki? Commented May 9, 2017 at 2:57

2 Answers 2

3

Presumably the cron job runs under another user which has an empty profile. This means git is not in the path.

The easiest way to fix this i to use the full path to git in the cron job.

You can find the full path to git by the command:which git

Sign up to request clarification or add additional context in comments.

3 Comments

Thanks, will it be like this? /usr/local/git/bin/git --work-tree=/home/userName/public_html --git-dir=/home/userName/public_html/.git pull
Different computers it would be a different thing. If you want to know the full path to git on bash, you can try which git.
@Edmundo , Yes that was what the answer already suggested. I think OP's comment was just trying to verify that she'd understood it all correctly.
0

First, run which git.

Then edit you .bashrc file and add export PATH=$PATH:$WHICH_GIT_PATH

Try again.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.