未找到git-receive-pack:命令 [英] git-receive-pack: command not found

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

问题描述

我试图使用Git推送到我的远程服务器,但它一直说git-receive-pack:命令未找到。我尝试搜索,有人说它的服务器,其他人说它是客户端。



操作系统:Windows 8 64位
服务器:CentOS操作系统与CPanel最新版本



Git内置于CPanel,我没有安装它。



http://imgur.com/Gg7uGcF,acp26eE



也许如果我知道哪个系统说错误我可以更好地排除故障。另外,我对SSH一无所知。我尝试插入由GIT生成的SSH密钥,但是当我尝试使用SSH时://它仍然只是要求输入密码。所以有些东西可能无法正确设置。我将git用户添加到系统中,并使用git指令说明的存储库,但我向用户添加了一个密码,只是为了查看它是否允许我在没有SSH的情况下登录。

git push 协议的 send-pack 部分运行时您的本地端,它连接到远程端运行的 receive-pack 部分。



假设你运行 git push ,其中您的远程 origin repo配置为使用ssh并映射到 server.com 。 Git使用 send-pack 来启动通过ssh连接到从远程URL * 提取的服务器的连接:

  $ ssh server.comgit-receive-pack /path/to/repo.git
$ b


* 当存储库以前被克隆或添加为 git remote add origin ssh: //server.com/path/to/repo.git



请注意,quoted命令运行通过远程服务器上的ssh,可能无法在那里找到 git-receive-pack 。您可以自己测试,如下所示:

  $ ssh server.comtype -p git-receive-pack|| echogit-receive-pack not found

如果确实 git- receive-pack 命令不能位于远程 - 例如,因为它不在远程登录shell的 PATH 中,所以可以告诉 git push 它应该通过运行来查找它:

  $ git push --receive- pack = / server / com / full / path / to / git-receive-pack 

保存输入,每次通过告诉git记住通过配置使用显式路径时推送:

  $ git config remote。 origin.receivepack / server / explicit / path / to / git-receive-pack 


I'm trying to use Git to push to my remote server, but it keeps saying git-receive-pack: command not found. I tried searching and some people say its the server, others say it's the client.

OS: Windows 8 64bit Server: Cent OS with CPanel newest version

Git is built in to CPanel, I didn't install it.

http://imgur.com/Gg7uGcF,acp26eE

Maybe if I knew which system was saying the error I could troubleshoot it better. Also, I know nothing about SSH. I tried inserting the SSH key that was generated by GIT but when I tried using SSH:// it would still just ask for the password. So something might not be setup correctly. I added the git user to the system with the repository like the git instructions said to do, but I added a password to the user just to see if it would let me login without SSH.

解决方案

When you run git push the send-pack part of the protocol is running on your, local side, and it connects to the receive-pack part running on the remote side.

So let's say you run git push, where your remote origin repo is configured to use ssh and is mapped to server.com. Git uses send-pack to initiate a connection over ssh to the server extracted from the remote URL *:

$ ssh server.com "git-receive-pack /path/to/repo.git"

* When the repository was previously cloned or added as git remote add origin ssh://server.com/path/to/repo.git

Note that the quoted command is run by ssh on the remote server, and it is possible that git-receive-pack could not be located there. You can test for this yourself as follows:

$ ssh server.com "type -p git-receive-pack" || echo "git-receive-pack not found"

If indeed the git-receive-pack command could not be located on the remote - for instance, because it is not in the PATH of your remote login shell, you can tell git push where it should look for it by running:

$ git push --receive-pack=/server/com/full/path/to/git-receive-pack

And you can save typing that every time you push by telling git to remember to use the explicit path via the config:

$ git config remote.origin.receivepack /server/explicit/path/to/git-receive-pack

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

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