'receive-pack':服务未启用'./.git' [英] 'receive-pack': service not enabled for './.git'

查看:457
本文介绍了'receive-pack':服务未启用'./.git'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我在一台计算机上运行git守护进程,并尝试与另一台计算机同步。



在计算机A上,我跑了:

$ p $ g $ daemon --reuseaddr --base -path =。 --export-all --verbose

在计算机B上,我运行:

  git clone git://computerA/.git source#工作
cd源
git pull#工作
git push#failed withfatal:远端意外挂断

在计算机A上,守护程序输出是:

  [5596]连接来自127.0.0.1:2476 
[5596]扩展属性(16字节)存在<宿主=本地主机>
[5596]为'/.git'
[5596]'receive-pack'请求接收包:服务未为'./.git'启用
[5444] [5596]已断开连接(有错误)

我将发布我发现的soultion。如果您有更完整的答案,请继续并添加它。 简单地运行

  git daemon --reuseaddr --base-path =。 --export-all --verbose --enable = receive-pack 

(在计算机A上,而是原始的 git守护进程命令),并且推送工作。



请注意,您必须运行 p>

  git reset --hard 

在计算机A上使其看到来自计算机B的变化。

发布脚本





最后,我意识到,如果拥有一台硬盘,将会更有意义。单独的存储库(a 裸露克隆),它没有任何文件,然后让计算机B推送它并从计算机A中拉出。通过这种方式,它可以双向工作,并以平滑的方式合并所有更改。你甚至可以有两个裸露的克隆,每个计算机上有一个克隆,并在它们之间进行推拉。


(Solved already, I'm writing this for the next guy)

I was running git daemon on one computer and tried synchronizing with another.

On computer A, I ran:

git daemon --reuseaddr --base-path=. --export-all --verbose

On computer B, I ran:

git clone git://computerA/.git source # worked
cd source
git pull # worked
git push # failed with "fatal: The remote end hung up unexpectedly"

On computer A, the daemon output is:

[5596] Connection from 127.0.0.1:2476
[5596] Extended attributes (16 bytes) exist <host=localhost>
[5596] Request receive-pack for '/.git'
[5596] 'receive-pack': service not enabled for './.git'
[5444] [5596] Disconnected (with error)

I'm going to post the soultion I found. If you have a more complete answer, please go ahead and add it.

解决方案

Simply run

git daemon --reuseaddr --base-path=. --export-all --verbose --enable=receive-pack

(on computer A, instead of the original git daemon command), and the push works.

Note that you have to then run

git reset --hard

on computer A to make it "see" the changes from computer B.

Post Script

The problem with doing a hard reset is that it overwrites whatever local changes you had on computer A.

Eventually I realized it would make much more sense to have a separate repository (a bare clone) that doesn't have any files in it, then have computer B push to it and computer A pull from it. This way it can work both ways and merge all the changes in a smooth fashion. You can even have two bare clones, one on each computer, and push-pull between them.

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

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