I'm quite new to bash, so I'm sorry if I'm asking something silly. Long story short, I'm trying to run the following bash script:


ACTION="init" # init or push
DRYRUN="-D" # use -D for dry-run

cd ./htdocs/app/

git checkout master # switch to master
git push # push to origin
git ftp $ACTION --user $USERNAME --passwd $PASSWORD $DRYRUN ftp://$HOST/$PATH

but when I do, I get the following error:

deploy.sh: line 12: git: command not found
deploy.sh: line 13: git: command not found
deploy.sh: line 14: git: command not found

If I were to follow the steps in the script directly myself, it works as intended, but not when running via bash.

I think it might have something to do with git not being in my $PATH, which looks like this: /home/daniel/.rvm/gems/ruby-1.9.3-p286/bin:/home/daniel/.rvm/gems/ruby-1.9.3-p286@global/bin:/home/daniel/.rvm/rubies/ruby-1.9.3-p286/bin:/home/daniel/.rvm/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/home/daniel/.rvm/bin but if that is the case, then I'm not sure how to add it.

Can someone help? Thank you :)

  • I'm facing same issue while building CI Bamboo client. This saying log: command not found for following command gitlog=git log ${bamboo.planRepository.previousRevision}..${bamboo.planRepository.revision} Any suggestion ? – CoDe Feb 8 '17 at 9:58

You've overwritten your PATH in your script. Don't overwrite it, just append "WebSite/app" to your PATH:


  • Whoops, so I have. I've changed both references to PATH in my script to REMOTEPATH, and it's now working as intended. Thank you. – Daniel Hollands Nov 17 '12 at 15:11

this should help

  1. find out where the git executable is so: which git

  2. if which returns ERROR ($? = 1), then git is not in your PATH

  3. find out where you installed it.

  4. replace git in your script with path_to_git/git, or modify PATH

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.