2010-03-29 14 views
21

Configuré .git en un directorio en mi máquina local. Luego ejecutar:¿Por qué Git-Daemon no servirá en mi repositorio?

mkdir a 
cd a 
git init 
git daemon

Cuando intento de clonar el repositorio en a, me sale el siguiente error:

mkdir b 
cd b 
git clone git://127.0.0.1 
Initialized empty Git repository in /b/127.0.0.1/.git/ 
fatal: The remote end hung up unexpectedly

¿Cómo puedo clonar mi repositorio git a través del protocolo?

Respuesta

39

es necesario dejar que git-daemon Sé que puede exportar su repositorio:

$ git init --bare /tmp/my-repo.git 
Initialized empty Git repository in /tmp/my-repo.git/ 

$ git daemon --verbose --base-path=/tmp --export-all /tmp/my-repo.git & 

$ git clone git://`hostname`/my-repo.git 
Initialized empty Git repository in /tmp/my-repo/.git/ 
warning: You appear to have cloned an empty repository.

una mejor forma de hacerlo es ejecutarlo desde xinetd. Crear y modificar /etc/xinetd.d/git lo largo de las líneas de

# description: The git server offers access to git repositories 
service git 
{ 
     disable = no 
     type   = UNLISTED 
     port   = 9418 
     socket_type  = stream 
     wait   = no 
     user   = nobody 
     server   = /usr/local/bin/git 
     server_args  = daemon --inetd --export-all --base-path=/pub/scm 
     log_on_failure += USERID 
} 

No se olvide de sudo killall -HUP xinetd. Ahora, todos los repositorios git debajo de /pub/scm estarán disponibles para cualquiera que pregunte.

13

O bien tiene que poner un archivo vacío llamado git-daemon-export-ok en el repositorio o iniciar git daemon con la opción --export-all.

Presupuesto de la git-daemon man page:

It verifies that the directory has the magic file "git-daemon-export-ok", and it will refuse to export any git directory that hasn't explicitly been marked for export this way (unless the --export-all parameter is specified). If you pass some directory paths as git daemon arguments, you can further restrict the offers to a whitelist comprising of those.

+1

Simplemente añadiendo lo siguiente: en mi caso "git-daemon-exportación-ok" no era legible por el usuario git-ro que se estaba ejecutando el demonio. – Belac

Cuestiones relacionadas