summaryrefslogtreecommitdiff
path: root/roles/git-http-backend/templates
diff options
context:
space:
mode:
authorJoe Carstairs <me@joeac.net>2026-09-24 08:24:01 +0100
committerJoe Carstairs <me@joeac.net>2026-09-24 08:24:01 +0100
commit55207ffd187fc703edfea2a40d118073678c813f (patch)
tree1ce9f6d9f823bd255e0fb6c661ec6f2c90b8c9b6 /roles/git-http-backend/templates
parenta036c3dfe1ae7af4429753d8ae232b140aef16fa (diff)
update git-http-backend configuration
Diffstat (limited to 'roles/git-http-backend/templates')
-rw-r--r--roles/git-http-backend/templates/git-http-backend.conf33
1 files changed, 19 insertions, 14 deletions
diff --git a/roles/git-http-backend/templates/git-http-backend.conf b/roles/git-http-backend/templates/git-http-backend.conf
index 26e012b..01c2cb4 100644
--- a/roles/git-http-backend/templates/git-http-backend.conf
+++ b/roles/git-http-backend/templates/git-http-backend.conf
@@ -1,22 +1,27 @@
location ~ /(.+)/(HEAD|info/refs|objects|git-upload-pack|git-receive-pack) {
if (-f /srv/git/$1/{{ git_export_ok_file }}) {
- set $auth_basic "private-write repository";
+ set $auth_basic "private-write repository";
}
if (!-f /srv/git/$1/{{ git_export_ok_file }}) {
- set $auth_basic "private repository";
+ set $auth_basic "private repository";
}
- if ($arg_service != git-receive-pack) {
- set $auth_basic off;
+ if ($arg_service = git-upload-pack) {
+ set $auth_basic off;
}
- auth_basic $auth_basic;
- auth_basic_user_file .htpasswd;
+ auth_basic $auth_basic;
- include fastcgi_params;
- fastcgi_param SCRIPT_FILENAME /usr/libexec/git-core/git-http-backend;
- fastcgi_param PATH_INFO $uri;
- fastcgi_param GIT_PROJECT_ROOT /srv/git;
- fastcgi_param GIT_HTTP_EXPORT_ALL 1;
- fastcgi_param REMOTE_USER $remote_user;
- fastcgi_param HOME /srv/git;
- fastcgi_pass unix:{{ fcgiwrap_socket }};
+ set $auth_basic_user_file /srv/git/.htpasswd;
+ if (-f /srv/git/$1/.htpasswd) {
+ set $auth_basic_user_file /srv/git/$1/.htpasswd;
+ }
+ auth_basic_user_file $auth_basic_user_file;
+
+ include fastcgi_params;
+ fastcgi_param SCRIPT_FILENAME /usr/libexec/git-core/git-http-backend;
+ fastcgi_param PATH_INFO $uri;
+ fastcgi_param GIT_PROJECT_ROOT /srv/git;
+ fastcgi_param GIT_HTTP_EXPORT_ALL 1;
+ fastcgi_param REMOTE_USER $remote_user;
+ fastcgi_param HOME /srv/git;
+ fastcgi_pass unix:{{ fcgiwrap_socket }};
}