sh: git: command not found

3,553 views
Skip to first unread message

caseybecking

unread,
Jul 24, 2011, 1:44:45 AM7/24/11
to Capistrano
i'm having an error why i run my deploy

sh: git: command not found

i have git installed and have also pointer the
set :git, "/path/to/git"
as well as
set :scm_command, "/usr/local/git/bin/git"

neither worked. The command im running i can run as the user using ssh
into the box. Any ideas?

Lee Hambley

unread,
Jul 24, 2011, 5:26:32 AM7/24/11
to capis...@googlegroups.com
Please paste a more complete log, also your workstation needs to have Git installed.

- Lee

caseybecking

unread,
Jul 24, 2011, 1:32:36 PM7/24/11
to Capistrano
Both the local and the server have git installed. Ip and path have
both been masked.

Password:
[xxx.xx.xx.xx] executing command
** [out :: xxx.xx.xx.xx] sh: git: command not found
** [out :: xxx.xx.xx.xx] sh: git: command not found
command finished in 825ms
failed: "sh -c 'cd /path/has/been/masked; git fetch origin; git reset
--hard origin/master'" on xxx.xx.xx.xx

now i can log onto the server via ssh and run the "sh -c 'cd /path/has/
been/masked; git fetch origin; git reset --hard origin/master'"
command without issues.

Craig White

unread,
Jul 26, 2011, 4:31:11 PM7/26/11
to capis...@googlegroups.com

On Jul 24, 2011, at 10:32 AM, caseybecking wrote:

> Both the local and the server have git installed. Ip and path have
> both been masked.
>
> Password:
> [xxx.xx.xx.xx] executing command
> ** [out :: xxx.xx.xx.xx] sh: git: command not found
> ** [out :: xxx.xx.xx.xx] sh: git: command not found
> command finished in 825ms
> failed: "sh -c 'cd /path/has/been/masked; git fetch origin; git reset
> --hard origin/master'" on xxx.xx.xx.xx
>
> now i can log onto the server via ssh and run the "sh -c 'cd /path/has/
> been/masked; git fetch origin; git reset --hard origin/master'"
> command without issues.

----
because you get an environment with a path

# which git
/usr/bin/git

change your 'git' commands to the full path /usr/bin/git (or adjust if your copy if git is installed somewhere else) and you won't get the command not found.

Craig

Reply all
Reply to author
Forward
0 new messages