'receive-pack': service not enabled for './.git'

前端 未结 3 1808
被撕碎了的回忆
被撕碎了的回忆 2020-12-01 09:19

(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:

3条回答
  •  长情又很酷
    2020-12-01 09:23

    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.

提交回复
热议问题