【问题标题】:sh: git-upload-pack: command not foundsh:git-upload-pack:找不到命令
【发布时间】:2012-03-16 07:00:05
【问题描述】:

我知道已经有类似的post,但似乎提出的解决方案对我不起作用...

我的同事在他的帐户下创建了一个存储库/git/work。在我的远程机器上,我可以执行以下操作:

... > git clone /users/.../HisAccount/git/work
Initialized empty Git repository in /import/.../MyAccount/work/.git/

但我需要远程控制我的机器/帐户,所以我在本地机器上尝试了以下操作并出现错误:

...@ubuntu$ git clone MyAccount@OurDomain:/users/.../HisAccount/git/work
Cloning into work...
MyAccount@OurDomain's password: 
sh: git-upload-pack: command not found
fatal: The remote end hung up unexpectedly

在我的本地和远程机器上,我都可以看到/usr/bin/git-upload-pack。我本地机器上的path/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games;我的远程机器上的path/users/.../MyAccount/bin/ubuntu /users/.../MyAccount/bin /user/local/bin /usr/bin /bin /usr/hosts /usr/ucb /usr/openwin/bin .

在我的本地机器上,我也试过这个:

... > git clone -u /usr/bin/git-upload-pack MyAccount@OurDomain:/users/.../HisAccount/git/work
Cloning into work...
MyAccount@OurDomain's password: 
sh: /usr/bin/git-upload-pack: No such file or directory
fatal: The remote end hung up unexpectedly

顺便说一句,我真的不知道.bashrc(用于 Bash)、.zshenv(用于 Zsh)或.cshrc(用于 tcsh)在哪里......

有人可以帮忙吗?

【问题讨论】:

    标签: git ubuntu ssh sh


    【解决方案1】:

    检查 $PATH, as set in your ".bashrc(for Bash),.zshenv(for Zsh),.cshrc`(对于 tcsh)"
    (取决于您正在运行的current shell

    其中一个文件应该在您的 $HOME (homedir) 中。

    来自 cmets,OP 确认

    • /usr/bin/git-upload-pack: No such file or directory 表示 PATH(这是正确的)实际上不包含 git-upload-pack 脚本。 This answer 建议对其进行符号链接。
    • git-upload-pack 脚本在远程端被调用,正如 OP 确认的那样:

    原来是远程机器有问题...我用另一台机器测试过,它可以工作。

    【讨论】:

    • 在远程机器上,这3个文件都不存在(shell是tcsh);在本地机器上,有.bashrc,但是我没有在里面找到path...
    • @SoftTimur 这些文件不必一直存在。只有当他/她想在他/她的 shell 会话中修改某些环境变量时,它们才由用户创建。
    • 那么,我应该在远程机器上添加.cshrc 并更改$PATH 吗?但它目前的$PATH 确实结束了usr/bin...
    • @SoftTimur:除了路径没有帮助:/usr/bin/git-upload-pack: No such file or directory。您需要检查 Git 安装。
    • 我需要检查本地机器或远程机器上的 git 安装吗?
    猜你喜欢
    • 2012-06-23
    • 2010-09-18
    • 1970-01-01
    • 2013-02-25
    • 2011-08-27
    • 2012-05-07
    • 2019-01-15
    • 1970-01-01
    相关资源
    最近更新 更多