My shared host did not provide git, so I built and installed it into ~/bin. When I ran it, I got the following error on most commands, although they were successful.
stdin: is not a tty
I can solve that problem by adding:
default_run_options[:pty] = true
to my deploy.rb, but then I get this error, which blocks deployment:
sh: git: command not found
How can I resolve both errors?
I tried adding a ~/.ssh/environment file with "PATH=$PATH:$HOME/bin"
(and changing sshd_config to use it) but it did nothing.
It seems whatever shell is being used by capistrano is not using the ~/.bashrc or ~/.bash_profile on the remote server.
Any ideas how to set the path on the remote machine?
other info: I'm using OS X locally, and the shared server is linux on Site5.
The ~/.ssh/environment file is not executed by a shell. It's a hardcoded environment file. If you want to set the path this way, you'll need to hardcode it instead of appending to $PATH. The other answers are possibly more correct, but setting ~/.ssh/environment correctly is a reliable fallback if all else fails.
You should be able to specify the full path to git like so:
set :scm_command, "/home/your_cap_runner_user/bin/git"
I haven't tried this out for myself - found it in the documentation in the source code for git.rb in Capistrano itself.
This is a great help, as I was running into the same issue as the original poster.
"Before" symptoms:
I now added set :scm_command, "~/bin/git" to my deploy.rb file.
ran cap deploy:cold (fails, with the following error)
:97:in ``': No such file or directory - ~/bin/git info git@github.com:quintar/eu reka.git -rHEAD (Errno::ENOENT)
So it looks like 'git' is recognized, but the repository I included in my deploy.rb is bypassed?
A quick workaround is to set the following in your deploy.rb file:
This will cause the checkout to occur on your own machine and then be copied to the deployment server.
Thanks, Chu - you put me on the right path.
just using:
set :scm_command, "~/bin/git"
still gave me errors, since my local git is not in that place.
However, the following seems to work, and to solve my issues:
set :scm_command, "~/bin/git"
set :local_scm_command, "/usr/local/bin/git"
This is probably because of CPanel installed on your shared host. It executes "mesg y" in global /etc/.bashrc file that is included in your ~/.bashrc one. So you can just comment-out the inclusion.
Here’s the source: http://webhostingneeds.com/Git_stdin_is_not_a_tty