Gitolite server-side setup for both http and ssh

2019-02-15 06:36发布

问题:

I am trying to set-up a git server using gitolite. So far, I have the server working with the ssh and I am not trying to add http support on top of it (final goal is to use LDAP for authentication)

I've followed http://sitaramc.github.com/gitolite/ssh-and-http.html how-to document.

I thought I had it all set-up so I tried:

git clone http://myServer/testing

and the result is:

Cloning into 'testing'... fatal: http://myServer/testing/info/refs not found: did you run git update-server-info on the server?

I've tried running git update-server-info from the actual server testing repository, and still the same result.

There is git-daemon-export-ok on the testing.git repository.

Could someone please help me solve this issue? I am not sure where I should begin..

Additional Information:
I am using Arch Linux (server side)

output from sudo suexec -V:

-D AP_DOC_ROOT="/srv/http"
-D AP_GID_MIN=99
-D AP_HTTPD_USER="http"
-D AP_LOG_EXEC="/var/log/httpd/suexec.log"
-D AP_SAFE_PATH="/usr/local/bin:/usr/bin:/bin"
-D AP_UID_MIN=99
-D AP_USERDIR_SUFFIX="public_html"

below is my VirtualHost section in my /etc/httpd/conf/httpd.conf

in the below section, servername is what I get from hostname command

<VirtualHost *:80>  
    ServerName        servername  
    ServerAlias       servername
    ServerAdmin       admin@server.com

    DocumentRoot /srv/http/git  
    <Directory /srv/http/git>  
        Options       None  
        AllowOverride none  
        Order         allow,deny  
        Allow         from all  
    </Directory>  

    SuexecUserGroup git git
    ScriptAlias /git/ /srv/http/bin/gitolite-suexec-wrapper.sh/
    ScriptAlias /gitmob/ /srv/http/bin/gitolite-suexec-wrapper.sh/

    <Location /git>
        AuthType Basic
        AuthName "Git Access"
        Require valid-user
        AuthUserFile /etc/httpd/conf/extra/git.passwd
    </Location>       
</VirtualHost>

output from ls -l /srv/http/

drwxr-xr-x 2 git  git  4096 Sep  6 22:02 bin
drwxr-xr-x 2 http http 4096 Sep  6 22:00 git

output from ls -l /srv/http/bin/gitolite-suexec-wrapper.sh

-rwx------ 1 git git 196 Sep  6 22:02 /srv/http/bin/gitolite-suexec-wrapper.sh

content of the gitolite-suexec-wrapper.sh:

#!/bin/bash
#
# Suexec wrapper for gitolite-shell
#

export GIT_PROJECT_ROOT="/home/git/repositories"
export GITOLITE_HTTP_HOME="/home/git"

exec ${GITOLITE_HTTP_HOME}/gitolite/src/gitolite-shell

回答1:

Your config defines an alias /git/ which will call your gitolite wrapper.
That means it will call it only for addresses like yourServer/git/...

You should at least try your clone with:

git clone http://myServer/git/testing

As the OP hoistyler references in this answer, the only remaining issue was an authentication one based on a file-based login.



回答2:

Thanks to VonC's guidance I've now solved the problem.

I've tried git clone http://myServer/git/testing and it gave me

Cloning into 'testing'...
Username for 'http://myServer': git
Password for 'http://git@myServer': 
fatal: Authentication failed

I looked into the logs, and figured out that my git.passwd file was somehow in the wrong format (I forgot how I created that file last time..)

I basically had to create my git.passwd file again:

htpasswd -c git.passwd git

Now it works! Thanks again VonC