Git-Push kann Repo nicht finden und schlägt mit Exit-Code 128 fehl

1176
Nux

Ich verwende CentOS 5.5 und muss Git Server darauf installieren.

Installiertes Git und Set-Home-Verzeichnis:

yum install git mkdir -p /home/git cd /home/git/ chmod 777 -R . # yeah I know this is evil, but I want to make it work first... 

Repo erstellt:

repoName=test-repo cd /home/git/ mkdir $repoName.git cd $repoName.git git --bare init git update-server-info chmod 777 -R . 

Installiertes Gitweb:

yum install gitweb cp -R /usr/share/gitweb/* /home/git/ 

(für mich war gitweb.cgi nach der Installation in usr / share / gitweb)

Geänderte Konfiguration von gitweb: /etc/gitweb.conf: unser $ projectroot = "/ home / git";

Und fügte schließlich diese Konfiguration zu Apache hinzu:

<VirtualHost *:80> ServerAlias git.domian.com  DocumentRoot /home/git SetEnv GITWEB_CONFIG /etc/gitweb.conf  <Directory /home/git> Order Allow,Deny Allow from all  Options +ExecCGI AddHandler cgi-script .cgi DirectoryIndex gitweb.cgi </Directory> </VirtualHost> 

Also funktioniert gitweb. Klon funktioniert (URL ist http://git.domain.com/test-repo.git ). Aber Push gibt:

git.exe push --progress "origin" master:master  fatal: repository 'http://git.domain.com/test-repo.git/' not found   git did not exit cleanly (exit code 128) (62 ms @ 2015-02-09 17:31:29) 

Ich habe versucht, die Konfiguration für Smart HTTP in der VirtualHost-Konfiguration wie folgt hinzuzufügen:

SetEnv GIT_PROJECT_ROOT /home/git SetEnv GIT_HTTP_EXPORT_ALL  ScriptAliasMatch \ "(?x)^/(.*/(HEAD | \ info/refs | \ objects/(info/[^/]+ | \ [0-9a-f]/[0-9a-f] | \ pack/pack-[0-9a-f]\.(pack|idx)) | \ git-(upload|receive)-pack))$" \ /usr/libexec/git-core/git-http-backend/$1 

Das änderte sich jedoch nur zu:

fatal: unable to access 'http://git.domain.com/test-repo.git/': The requested URL returned error: 403 

Ich habe Auth noch nicht hinzugefügt. Was ist das Problem?

Bitte helfen Ich werde auf git verzichten müssen und zurück zu svn gehen, wenn das nicht funktioniert ...

0

1 Antwort auf die Frage

0
Nux

OK. Es war also so einfach wie das Hinzufügen der Authentifizierung. Da ich LDAP-Authentifizierung (Active Directory-basiert) verwenden wollte, habe ich Folgendes verwendet ... Beachten Sie, dass Ihre Pfade und Kennwörter variieren können ;-)

/etc/gitweb.conf

our $projectroot = "/home/git"; 

/etc/httpd/conf.vhosts/httpd-vhosts.conf

<VirtualHost *:80> Include conf.vhosts/git.conf </VirtualHost> # if you want HTTPS <VirtualHost *:443> Include conf.vhosts/git.conf  SSLEngine on SSLCertificateFile "/var/www/certs/subdomains-cert.pem" SSLCertificateKeyFile "/var/www/certs/subdomains-key.pem" </VirtualHost> 

/etc/httpd/conf.vhosts/git.conf

# # Common # ServerAlias git.mol.com.pl  DocumentRoot /home/git SetEnv GITWEB_CONFIG /etc/gitweb.conf  <Directory /home/git> Order Allow,Deny Allow from all  Options +ExecCGI AddHandler cgi-script .cgi DirectoryIndex gitweb.cgi </Directory>  SetEnv GIT_PROJECT_ROOT /home/git SetEnv GIT_HTTP_EXPORT_ALL  AliasMatch ^/(.*/objects/[0-9a-f]/[0-9a-f])$ /home/git/$1 AliasMatch ^/(.*/objects/pack/pack-[0-9a-f].(pack|idx))$ /home/git/$1 ScriptAliasMatch \ "(?x)^/(.*/(HEAD | \ info/refs | \ objects/info/[^/]+ | \ git-(upload|receive)-pack))$" \ /usr/libexec/git-core/git-http-backend/$1  <Location /> AuthType Basic AuthBasicProvider ldap AuthBasicAuthoritative on AuthUserFile /dev/null AuthLDAPURL ldap://our.domain.server.com/CN=Users,DC=our,DC=domain,DC=server,DC=com?sAMAccountName AuthLDAPBindDN CN=someWindowsDomainUser,CN=Users,DC=our,DC=domain,DC=server,DC=com AuthLDAPBindPassword someWindowsDomainUserSecretPassword  Order Allow,Deny Allow from all </Location>  # # Test repo # <Location /test-repo.git> AuthName "Test-bare-repo"  require valid-user </Location>