问题描述
我读过这个答案大约八五倍,但有些事我没有正确理解:
I've read this answer about eight-five times, but there's something I'm not understanding correctly:
git-upload-pack:命令未找到,如何解决这一问题正确
当我尝试克隆我的服务器上的存储库,我得到以下内容:
When I try to clone a repository on my server, I get the following:
bash: git-upload-pack: command not found
但是当我通过给克隆 -u在/ usr / local / bin目录/混帐上传包
选项克隆,一切运作良好。
But when I clone by giving clone the -u /usr/local/bin/git-upload-pack
option, all works well.
我想这是有道理的,因为这是我的服务器上的混帐上传包的位置。
I guess this makes sense, since that's the position of the git-upload-pack on my server.
最多的回答表明,在服务器上我的.bashrc文件需要更新,以反映这一点,作为 SSH您@ remotemachine回声\\ $ PATH
不返回的/ usr / local / bin目录。 (它返回的/ usr / bin中:/ bin中:/ usr / sbin目录:/ sbin目录
)。
The top answer suggests my .bashrc file on server needs to be updated to reflect this, as the result of ssh you@remotemachine echo \$PATH
does not return /usr/local/bin
. (It returns /usr/bin:/bin:/usr/sbin:/sbin
).
但是,当我看着我的.bashrc文件,它包含:
But when I look at my .bashrc file, it contains:
export PATH=/usr/local/bin:$PATH
所以现在我感到困惑。
So now I'm confused.
什么我需要做的,避免使用 -u在/ usr / local / bin目录/混帐上传包
选项每一次?为什么 SSH您@ remotemachine回声\\ $ PATH
不返回的/ usr / local / bin目录
?这是与登录和非登录shell?
What do I need to do to avoid using the -u /usr/local/bin/git-upload-pack
option every time? Why does ssh you@remotemachine echo \$PATH
not return /usr/local/bin
? Is this something to do with login and non-login shells?
请帮帮忙!先谢谢了。
推荐答案
这是连接到这个问题:
http://serverfault.com/questions/130834/svnssh-getting-bash-to-load-my-path-over-ssh
SSH是不是没有打算交互方式发送指令时默认加载您的环境。
Ssh is not loading your environment by default when sending a command without going to interactive mode.
好的解决方案是一个与的.ssh / environment文件:
good solution is the one with .ssh/environment file:
在/ etc / SSH / sshd_config中添加:
in /etc/ssh/sshd_config add:
PermitUserEnvironment yes
然后,只需创建的.ssh /目录和转储envronment到的.ssh /环境:
Then just create .ssh/ directory and dump envronment to .ssh/enviroment:
cd ~/
mkdir .ssh
env > .ssh/environment
重新启动SSH
Restart SSH
/etc/init.d/sshd restart
现在,当您从本地机器做到这一点:
Now when you do this from your local machine:
ssh [email protected] "which git-upload-pack"
您s'd获得
/usr/local/bin/git-upload-pack
和混帐克隆s'd工作。
and git clone s'd work.
这篇关于混帐上载包装:命令未找到的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!