The thing your nginx/apache mounts to serve repos over HTTPS.
git http-backend is a CGI program that speaks the smart HTTP transport. Mount it behind nginx, Apache, or any CGI-capable web server to serve repos over HTTP(S).
The web server handles TLS, auth, and URL routing; http-backend handles only the Git protocol on top. Authentication is the front-end's job — http-backend trusts REMOTE_USER and the AUTH_TYPE env vars the web server hands it.
SetEnv GIT_PROJECT_ROOT /srv/git
SetEnv GIT_HTTP_EXPORT_ALL
ScriptAlias /git/ /usr/lib/git-core/git-http-backend/
# URL shape served:
# GET /<repo>.git/info/refs?service=git-upload-pack (advertise refs)
# POST /<repo>.git/git-upload-pack (fetch/clone)
# POST /<repo>.git/git-receive-pack (push)| Flag | What it does |
|---|---|
http.uploadpack | Per-repo flag to allow fetch/clone over HTTP (default true) |
http.receivepack | Per-repo flag to allow push over HTTP (default false — must enable) |
http.allowReachableSHA1InWant | Permit clients to ask for any reachable SHA-1, not just advertised refs |
GIT_PROJECT_ROOT | Env var: directory containing the repos to serve |
GIT_HTTP_EXPORT_ALL | Env var: serve all repos, ignoring git-daemon-export-ok |
REMOTE_USER | Env var set by the web server after auth — written into reflog for pushes |
http.receivepack=true without auth | ⚠️ Anonymous push — never deploy this on the open internet |
curl -v 'http://127.0.0.1/git/repo.git/info/refs?service=git-upload-pack'git -C /srv/git/repo.git config http.receivepack truefastcgi_param SCRIPT_FILENAME /usr/lib/git-core/git-http-backend; fastcgi_param GIT_PROJECT_ROOT /srv/git; fastcgi_param GIT_HTTP_EXPORT_ALL '';git clone http://127.0.0.1/git/repo.gitHit each option, then Check answers. Score is recorded; Next is always open.