Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

git

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

like image 402
itsadok Avatar asked Apr 27 '09 08:04

itsadok


People also ask

What is git daemon?

git-daemon is a simple server for git repositories. The daemon makes git repositories available over the git:// protocol, which is very efficient, but insecure.

What does git upload pack do?

Description. Invoked by git fetch-pack, learns what objects the other side is missing, and sends them after packing. This command is usually not invoked directly by the end user.

What is git push origin master?

Origin is simply the name given to any remote repository available on GitHub. Whenever we need to push the changes to a remote repository, we use git push along with the remote repository “origin” and “master” branches. The term used is “git push origin master“.

What protocol does git use?

Git can use four distinct protocols to transfer data: Local, HTTP, Secure Shell (SSH) and Git. Here we'll discuss what they are and in what basic circumstances you would want (or not want) to use them.


1 Answers

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.

like image 112
itsadok Avatar answered Oct 08 '22 13:10

itsadok