.bashrc (on user account):
export PATH=/usr/bin:$PATH
开发者_StackOverflow中文版How can I get Git to work on accounts other than Root?
As root
, do which git
:
[ 08:45 root@host ~ ]# which git
/usr/local/bin/git
then take the path that is returned (/usr/local/bin/git
, or whatever) and add it (except for the last /git
part) to that line of the users .bashrc
like so:
[ 08:45 jon@host ~ ]$ vi ~/.bashrc
export PATH=/usr/bin:$PATH:/usr/local/bin
Then source
the .bashrc
file:
[ 08:45 jon@host ~ ]$ source ~/.bashrc
Also, make sure the file is executable by all (not just root
) with chmod 755
so it looks like this:
[ 08:45 jon@host ~ ]$ sudo chmod 755 /usr/local/bin/git
[ 08:45 jon@host ~ ]$ ls -l /usr/local/bin/git
-rwxr-xr-x@ 1 root root 613B Jan 12 15:26 git
My problem was solved by making this entry in my deploy.rb file: set :local_scm_command, :default
Please see the entry in this link: https://github.com/capistrano/capistrano/wiki/2.x-From-The-Beginning
"A quick aside: you might have subversion (or whatever SCM you’re using) installed, but in a place that’s not in the standard path. (The standard path is typically /bin:/usr/bin:/usr/sbin.) If this is the case, Capistrano won’t be able to find your svn executable, and you’ll need to tell Capistrano explicitly where it is. To do so, set :scm_command to the path on the remote servers where it is located. If you do this, though, you might discover that Capistrano can no longer find the command on the local server; in that case, set :local_scm_command to :default (or to the explicit path on your local server)."
精彩评论