LoranceChen
LoranceChen

Reputation: 2574

How to open git-http-backend as a http server?

Git official document shows the way use git server via http with apache and git-http-backend.
I want straight interactive with git-http-backend in my program via http.

It's just like what's the apache proxy does but I need control more things from git client, such as refuse client pull by his username and the path of repository directory what he request.

how to use git-http-backend as a http service straightly?

Upvotes: 1

Views: 2073

Answers (2)

VonC
VonC

Reputation: 1323943

You can read its documentation at docs/git-http-backend and see its sources in http-backend.c (tested here).

Sicne it is a Common Gateway Interface (CGI), it is called by a listener, like an http server, but also any other listener(!), like SSH.

See Gitolite (an authorization layer), which does precisely that: since it is called git-xxx (here: git-hhtp-backend), you can call: git http-backend: that is what its gitolite-shell does.

Since that backend in turn calls git services (git-upload-pack, git-receive-pack, objects/info/packs, ...), you can do what git-http-backend does directly. That is also what gitolite implements here.

Upvotes: 0

user2404501
user2404501

Reputation:

git-http-backend is described in the documentation as a CGI program. Since a CGI program alone doesn't speak HTTP, you must either talk to it with the CGI protocol instead (this is an inter-process communication protocol involving environment variables and stdin and stdout) or hook it up to an HTTP server such as Apache.

The name might be confusing, but this "HTTP backend" goes behind the HTTP server.

Upvotes: 1

Related Questions