找不到git-receive-pack [英] git-receive-pack not found

查看:93
本文介绍了找不到git-receive-pack的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在运行osx 10.8.2的mac mini上设置远程git服务器.我已经设置了ssh,以便客户端可以连接到远程主机上的git帐户.当我尝试从一个客户端执行git push origin master时,出现以下错误:

I am trying to set up a remote git server on a mac mini running osx 10.8.2. I have set up ssh so that the clients can connect to the git account on the remote host. When I try to execute git push origin master from one client I get the following error:

bash:git-receive-pack:找不到命令

bash: git-receive-pack: command not found

致命:无法从远程存储库读取.

fatal: Could not read from remote repository.

(从另一个客户端我得到:

(From another client I get:

bash:git-upload-pack:找不到命令

bash: git-upload-pack: command not found

致命错误.

我确保在客户端和主机上的路径中都安装了git receive pack和git upload pack.

I have made sure that git receive pack and git upload pack are installed and in the path on both the client and host.

我该怎么做才能解决问题或解决问题?

What can I do to fix or troubleshoot the problem?

推荐答案

通读

Reading through this post helped me figure out how to solve the problem. Because the thread assumes background knowledge that I did not have (and which other novices may not have), I summarize and try to simplify the answer here.

Git推送显然是通过非登录"帐户(即没有密码的帐户)起作用的.请参见此处.非登录git帐户的路径变量与普通登录​​帐户的路径不同.即使您登录到远程计算机,键入echo $ PATH仍将仅显示您的路径,非登录帐户的路径.要查看非登录帐户的路径,您必须(从客户端)键入:

Git push apparently works through a "non-login" account, i.e., one which does not have a password. See here. The path variable for the non-login git account is different from the path for an ordinary login account. Even if you login into the remote machine, typing echo $PATH will still only show your path, not the path of the non-login account. To see what the path of the non-login account is you have to type (from the client):

ssh you @ remotemachine echo \ $ PATH

ssh you@remotemachine echo \$PATH

(反斜杠可防止本地计算机在到达远程计算机之前拦截和扩展$ PATH变量.)这样做将返回非登录帐户的路径.就我而言,非登录帐户的默认路径不包括相关git文件的路径.将路径添加到git-upload& c后,一切正常.可以通过在.bashrc(对于Bash)、. zshenv(对于Zsh)、. cshrc(对于tcsh)或在您的Shell中等效)中为远程计算机上的非登录帐户添加正确的路径. "

(The backslash keeps the local machine from intercepting and expanding the $PATH variable before it gets to the remote machine.) Doing so returns the path for non-login accounts. In my case, the default path for non-login accounts did not include the path to the relevant git files. Once I added the path to git-upload &c, everything worked fine. The correct path can be added to the default path for non-login accounts on the remote machine by "setting it in .bashrc (for Bash), .zshenv (for Zsh), .cshrc (for tcsh) or equivalent for your shell."

希望这对其他人有帮助.

Hope this helps anyone else with this problem.

这篇关于找不到git-receive-pack的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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