gitolite - smart-http - gives uninitialised value

2019-06-07 15:45发布

问题:

I'm getting the following error in my /var/log/apache2/error.log when I try to do a git clone to my server running gitolite with smart-http enabled

[Wed Jul 25 21:53:36 2012] [error] [client 124.149.104.106] FATAL: warn\tUse of 
uninitialized value $rc{"UMASK"} in umask at /opt/git/gitolite-source/src/
gitolite-shell line 95, <DATA> line 1.<<newline>>

I do have the UMASK value set to 0027 in /home/git/.gitolite.rc

Any thoughts why the value isn't setting when called from an su_exec from a file in sites-available?

I'm running apache as www-data - and have set up permissions on the various scripts as per the instructions here - ie:

install -d -m 0755 -o git -g git /var/www/bin
install -d -m 0755 -o www -g www /var/www/git

and then:

create a shell script inside /var/www/bin named gitolite-suexec-wrapper.sh, with mode 0700 and owned by user and group git.

回答1:

Ok got it - basically I reinstalled starting from scratch:

  1. Install gitolite (installing the source to the /home/git directory and running the setup as the git user using su - git)
  2. Read the warning here
  3. Run the steps in this document (ie not run the file - just line by line)
  4. Don't run the exports here as we'll run gitolite as the git user
  5. Install gitweb using apt-get - configure it to point to the repositories at /home/git/repositories
  6. Put the following into the apache site configuration here /etc/apache2/sites-available/git.servername.com

    <VirtualHost *:80>
        ServerAdmin mail@servername.com
        ServerAlias git
        ServerName git.servername.com
    
        DocumentRoot /var/www/git
    
        <Directory /var/www/git>
          Options +Indexes
          AllowOverride none
          Order allow,deny
          Allow from all
        </Directory>
    
        SuexecUserGroup git git
        ScriptAlias /git/ /var/www/bin/gitolite-suexec-wrapper.sh/
        ScriptAlias /gitmob/ /var/www/bin/gitolite-suexec-wrapper.sh/
    
        <Location /git>
          AuthType Basic
          AuthName "Git Access"
          Require valid-user
          AuthUserFile /home/git/gitolite-http-authuserfile
        </Location>
        Loglevel warn
        ErrorLog /var/log/apache2/error.log
        CustomLog /var/log/apache2/access.log combined
    </VirtualHost>
    
  7. Use the styles for gitweb from here.

  8. Now I can access my site via ssh using git clone ssh://git@git.servername.com:gitolite-admin.git http://admin@git.servername.com/git/testing.git

    and view it at http://servername.com/gitweb