git - '接收包' : service not enabled for './.git'

标签 git

(已经解决了,我正在为下一个人写这个)

我在一台计算机上运行 git daemon 并尝试与另一台计算机同步。

在计算机 A 上,我运行:

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

在计算机 B 上,我运行:

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

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

[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)

我要发布我找到的灵魂。如果您有更完整的答案,请继续添加。

最佳答案

简单运行

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

(在计算机 A 上,而不是原来的 git daemon 命令),并且推送有效。

请注意,您必须然后运行

git reset --hard

在计算机 A 上使其“看到”来自计算机 B 的更改。

后脚本

进行硬重置的问题在于它会覆盖您在计算机 A 上所做的任何本地更改。

最终我意识到,拥有一个没有任何文件的单独存储库(bare clone)会更有意义,然后让计算机 B 推送到它,计算机 A 从中 pull 出。这样它就可以双向工作并以平滑的方式 merge 所有更改。您甚至可以有两个裸克隆,每台计算机一个,并在它们之间进行推 pull 。

关于git - '接收包' : service not enabled for './.git' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/792611/

相关文章:

git - 使用 GIT 对 Java 网站进行版本控制的最佳方法是什么

windows - Git 子树添加在项目 .gitignore 文件上失败(使用 Windows)

node.js - 从 git 子目录部署到 heroku

git undo merge and add for 单个文件

Git:如何获取单个远程分支并自动创建它的远程跟踪分支?

git - 什么管道命令提供与 git log --follow 相同的功能?

没有 SSH 的 Git 和 Bitbucket

git - 使用 --depth 1 克隆后使用 git pull 更新

eclipse - 如何将 .txt.gz 文件推送到 git

git - Heroku + Github 部署策略