Using capistrano when remote git is on a non-stand

2019-06-19 01:44发布

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.

7条回答
劳资没心,怎么记你
2楼-- · 2019-06-19 02:34

The problem is that you've set

default_run_options[:pty] = true

which means that your .bash_profile or your usual shell init file won't be run, which is not the case when you set it to false -- but then you'll have issues when it wants to ask you for the password.

To get around this problem, you can manually set your PATH environment variable in your deploy file:

default_environment['PATH'] = "/your/path/to/git:/and/any/other/path/you/need"
查看更多
登录 后发表回答