handle git URLs (but this doesn't work)
authorShane Jaroch <chown_tee@proton.me>
Thu, 15 Jan 2026 22:16:28 +0000 (17:16 -0500)
committerShane Jaroch <chown_tee@proton.me>
Thu, 15 Jan 2026 22:16:28 +0000 (17:16 -0500)
etc/nginx/conf.d/git-http.conf

index bd63baf5bd9f8f0b7332af6b266b5f8142e11030..58bd8c3cbb75cd7c542ab8364782040bdc46e457 100644 (file)
@@ -110,13 +110,29 @@ server {
         return 302 /v3/admin;
     }
 
-    location /v3/ {
+    location ^~ /v3/ {
         proxy_pass http://localhost:3000/;
         proxy_set_header Host $host;
         proxy_set_header X-Real-IP $remote_addr;
         proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
         proxy_set_header X-Forwarded-Proto $scheme;
     }
+
+    # ----------------------------------------------------------------------
+    # Clean Git Remotes (Root Level .git)
+    # ----------------------------------------------------------------------
+    # Catches /user/repo.git and /user/repo.git/info/refs
+    # Place this AFTER v1/v2 regex blocks so it doesn't interfere with them
+    location ~ \.git(/|$) {
+        proxy_pass http://localhost:3000;
+        proxy_set_header Host $host;
+        proxy_set_header X-Real-IP $remote_addr;
+        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
+        proxy_set_header X-Forwarded-Proto $scheme;
+
+        # Recommended for Git Pushes
+        client_max_body_size 512M;
+    }
 }
 
 # HTTP to HTTPS redirect