Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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: line 12: git: command not found line 13: git: command not found 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 :)

share|improve this question

migrated from Nov 18 '12 at 1:41

This question came from our site for professional and enthusiast programmers.

up vote 6 down vote accepted

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


share|improve this answer
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

share|improve this answer
  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

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .