root 可以使用 Git,但任何其他帐户:-bash: git: command not find
.bashrc(在用户帐户上):
export PATH=/usr/bin:$PATH
如何让 Git 在 Root 以外的帐户上工作?
.bashrc (on user account):
export PATH=/usr/bin:$PATH
How can I get Git to work on accounts other than Root?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
作为
root
,执行which git
:然后获取返回的路径(
/usr/local/bin/git
,或其他)并添加它(除了最后一个/git
部分)到用户.bashrc
的那一行,如下所示:然后
source
.bashrc
文件:另外,请确保该文件可供所有人执行(不仅仅是
root
) 和chmod 755
所以它看起来像这样:As
root
, dowhich 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:Then
source
the.bashrc
file:Also, make sure the file is executable by all (not just
root
) withchmod 755
so it looks like this:通过在我的deploy.rb 文件中添加以下条目解决了我的问题:
set :local_scm_command, :default
请参阅此链接中的条目:
https://github.com/capistrano/capistrano/wiki/2 .x-From-The-Beginning
“顺便说一句:您可能安装了 subversion(或您正在使用的任何 SCM),但安装的位置不在标准路径中。(标准路径通常是/bin:/usr/bin:/usr/sbin。)如果是这种情况,Capistrano 将无法找到您的 svn 可执行文件,您需要明确告诉 Capistrano 它在哪里,为此,请设置。 :scm_command 到它所在的远程服务器上的路径,但是,如果您这样做,您可能会发现 Capistrano 在这种情况下无法再在本地服务器上找到该命令; :local_scm_command 到 :default (或本地服务器上的显式路径)。”
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)."