Gitolite, gitweb and nginx
To be able to fully enjoy using Git over HTTP(s) - you need to make sure you've got an up to date version of nginx and has fastcgi enabled for CGI support. As there's plenty of guides for this out there - I'm not going to dwell into that any further. In my examples I'm using HTTP basic auth as I really don't like people peaking into my private Git repositories.
Also worth mentioning is that this is configured on a CentOS 6 box, but aside from having pulled everything from a repository - you could however just as easily build it from source. In the latter case just make sure you've updated the fullpath to match the home of Gitolite. It's also worth mentioning that I've chosen to put my password file i /etc/nginx/gitolite.htpasswd - you can place it anywhere you like, but just make sure nginx has read access to it - and the usernames matches the ones Gitolite has listed too.
So without further adue here's the needed bits to have all this flying
location ~ /git(/.) {
auth_basic "Happy GIT server"; auth_basic_user_file /etc/nginx/gitolite.htpasswd; fastcgi_pass unix:/var/run/fcgiwrap.socket; include /etc/nginx/fastcgi_params; fastcgi_param SCRIPT_FILENAME "/srv/gitolite/bin/gl-auth-command"; fastcgi_param GIT_PROJECT_ROOT /srv/gitolite/repositories; fastcgi_param GIT_HTTP_EXPORT_ALL ""; fastcgi_param GITOLITE_HTTP_HOME /srv/gitolite; fastcgi_param AUTH_USER $remote_user; fastcgi_param REMOTE_USER $remote_user; fastcgi_param PATH_INFO $1; } location ~ /git$ { auth_basic "Happy GIT server"; auth_basic_user_file /etc/nginx/gitolite.htpasswd; fastcgi_pass unix:/var/run/fcgiwrap.socket; include /etc/nginx/fastcgi_params; fastcgi_param SCRIPT_FILENAME "/srv/gitolite/bin/gl-auth-command"; fastcgi_param GIT_PROJECT_ROOT /srv/gitolite/repositories; fastcgi_param GIT_HTTP_EXPORT_ALL ""; fastcgi_param GITOLITE_HTTP_HOME /srv/gitolite; fastcgi_param AUTH_USER $remote_user; fastcgi_param REMOTE_USER $remote_user; } location @gitwebhandler { rewrite /gitweb /gitweb.cgi; } location /gitweb { alias /var/www/git; auth_basic "Happy GIT server"; auth_basic_user_file /etc/nginx/gitolite.htpasswd; index gitweb.cgi; try_files $uri $uri/ @gitwebhandler; expires 10d; location ~ .(css|png|gif|ico|jpe?g|js) { expires 31d; } location ~ .cgi$ { root /var/www/git; if (!-e $requestfilename) { rewrite / /gitweb.cgi last; } expires off; fastcgipass unix:/var/run/fcgiwrap.socket; fastcgiindex gitweb.cgi; fastcgiparam SCRIPTNAME $fastcgiscriptname; fastcgiparam SCRIPTFILENAME $documentroot$fastcgiscriptname; fastcgiparam AUTHUSER $remoteuser; fastcgiparam REMOTEUSER $remoteuser; include /etc/nginx/fastcgi_params; } }