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

前端 未结 3 1803
被撕碎了的回忆
被撕碎了的回忆 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.

    0 讨论(0)
  • 2020-12-01 09:25

    I have some issue with the git reset --hard so here is my alternative solution.

    On the local cloned repo make a branch

    git checkout -b my_new_branch
    

    on the remote origin repo enable the receive-pack service

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

    push the new branch to remote origin

    git push origin my_new_branch
    

    merge the new branch on origin with

    git merge my_new_branch
    
    0 讨论(0)
  • 2020-12-01 09:47

    I encountered this error, but the solution seems different for those using git-http-backend. (git push/pull/clone over http instead of ssh or git)

    This must be done on the remote server, and is best done on creation. (last line can be run independently if repo already exists / is in use)

    $ mkdir eddies  # MAKE folder for repo
    $ chown -R eddie:websrv eddies/  #ensure apache (webserver) can access it
    $ cd eddies/
    $ git --bare init --shared
    Initialized empty shared Git repository in /var/git/eddies/
    $ ls
    branches  config  description  HEAD  hooks  info  objects  refs
    $ git config --file config http.receivepack true
    
    0 讨论(0)
提交回复
热议问题