当克隆远程Git仓库时,找不到git-upload-pack:命令 [英] git-upload-pack: command not found, when cloning remote Git repo

查看:1586
本文介绍了当克隆远程Git仓库时,找不到git-upload-pack:命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在使用git来保持项目的两个副本同步,一个是我的本地框,另一个是测试服务器。
这是使用ssh登录到远程开发服务器时发生的问题;

  git clone me @ me .mydevbox.com:/ home / chris / myproject 
在/tmp/myproject/.git/中初始化了空的Git存储库
密码:
bash:git-upload-pack:找不到命令
致命:远程终端意外挂断$'b $ b fetch-pack'from me@me.mydevbox.com:/ home / chris / myproject'失败。

(文件名已被更改以保护有罪...!)



这两个盒子都运行Solaris 10 AMD。我已经做了一些挖掘,如果我添加了 - upload-pack = $(which git-upload-pack)命令有效,并证明 $ PATH 包含按照RTFM解决方案的'git-upload-pack'的路径),但这真的很烦人,再加上'git push'不起作用,因为我不认为是 - unpack = 选项。顺便说一句,所有的git命令都可以在我的本地机器上正常工作,它与软件(1.5.4.2)的相同版本安装在同一个NFS挂载点上,<

code>的/ usr / local / bin中。



任何人都可以提供帮助吗?

解决方案

确保 git-upload-pack 位于非登录shell的路径中。 (在我的机器上它位于 / usr / bin 中)。



要查看远程路径你可以试试这个:

  ssh you @ remotemachine echo \ $ PATH 

code>

(这可以在Bash,Zsh和tcsh中使用,也可能在其他shell中使用。)



如果它返回的路径不包含具有 git-upload-pack 的目录,则需要通过将其设置在 .bashrc (用于Bash), .zshenv (用于Zsh), .cshrc

您需要在远程计算机上进行此更改。


$ b(对于tcsh)或您的shell的等效项。 $ b

如果您不确定需要添加到远程 PATH 的路径,可以使用此命令找到它(您需要在远程机器):

哪个git-upload-pack



在我的机器上打印 / usr / bin / git-upload-pack 。因此,在这种情况下, / usr / bin 是您需要确保远程非登录shell PATH


I have been using git to keep two copies of my project in sync, one is my local box, the other the test server. This is an issue which occurs when I log onto our remote development server using ssh;

git clone me@me.mydevbox.com:/home/chris/myproject
Initialized empty Git repository in /tmp/myproject/.git/
Password:
bash: git-upload-pack: command not found
fatal: The remote end hung up unexpectedly
fetch-pack from 'me@me.mydevbox.com:/home/chris/myproject' failed.

(the file-names have been changed to protect the guilty... !)

Both boxes run Solaris 10 AMD. I have done some digging, if I add --upload-pack=$(which git-upload-pack) the command works, (and proves that $PATH contains the path to 'git-upload-pack' as per the RTFM solution) but this is really annoying, plus 'git push' doesn't work, because I don't think there is a --unpack= option.

Incidentally, all the git commands work fine from my local box, it is the same version of the software (1.5.4.2), installed on the same NFS mount at /usr/local/bin.

Can anybody help?

解决方案

Make sure git-upload-pack is on the path from a non-login shell. (On my machine it's in /usr/bin).

To see what your path looks like on the remote machine from a non-login shell, try this:

ssh you@remotemachine echo \$PATH

(That works in Bash, Zsh, and tcsh, and probably other shells too.)

If the path it gives back doesn't include the directory that has git-upload-pack, you need to fix it by setting it in .bashrc (for Bash), .zshenv (for Zsh), .cshrc (for tcsh) or equivalent for your shell.

You will need to make this change on the remote machine.

If you're not sure which path you need to add to your remote PATH, you can find it with this command (you need to run this on the remote machine):

which git-upload-pack

On my machine that prints /usr/bin/git-upload-pack. So in this case, /usr/bin is the path you need to make sure is in your remote non-login shell PATH.

这篇关于当克隆远程Git仓库时,找不到git-upload-pack:命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆