diff options
| author | Ariel Costas <arielcostas@mailbox.org> | 2022-07-16 17:41:44 +0200 |
|---|---|---|
| committer | Ariel Costas <arielcostas@mailbox.org> | 2022-07-16 17:41:44 +0200 |
| commit | 7ca77d1d8953e3ac6fe8283ed32cdb6cac0706e2 (patch) | |
| tree | 326dca5b53a512db5fc3c387ee366b018710479b /content/cgit.md | |
| parent | 0159e33caf9f07174ea94ecbc9aaa4d8d7cd776f (diff) | |
Include it as part of NGINX conf
Instead of adding several new paragraphs, just keep it simple and say
it's doing it as part of the base guide.
Diffstat (limited to 'content/cgit.md')
| -rw-r--r-- | content/cgit.md | 47 |
1 files changed, 14 insertions, 33 deletions
diff --git a/content/cgit.md b/content/cgit.md index 12d0c2f..63bcf80 100644 --- a/content/cgit.md +++ b/content/cgit.md @@ -48,6 +48,16 @@ server { root /usr/share/cgit ; try_files $uri @cgit ; + location ~ /.+/(info/refs|git-upload-pack) { + include fastcgi_params; + fastcgi_param SCRIPT_FILENAME /usr/lib/git-core/git-http-backend; + fastcgi_param PATH_INFO $uri; + fastcgi_param GIT_HTTP_EXPORT_ALL 1; + fastcgi_param GIT_PROJECT_ROOT /srv/git; + fastcgi_param HOME /srv/git; + fastcgi_pass unix:/run/fcgiwrap.socket; + } + location @cgit { include fastcgi_params; fastcgi_param SCRIPT_FILENAME /usr/lib/cgit/cgit.cgi; @@ -58,7 +68,9 @@ server { } ``` -Then get NGINX to reload your configuration. +Then get NGINX to reload your configuration. This configuration also enables +cloning via HTTPS, so make sure to point the `fastcgi_param GIT_PROJECT_ROOT` +to the directory where you store your repositories. ## Configuring cgit @@ -70,6 +82,7 @@ configure Cgit to our liking, by editing `/etc/cgitrc`. css=/cgit.css logo=/cgit.svg virtual-root=/ +clone-prefix=https://git.example.org # Title and description shown on top of each page root-title=Chad's git server @@ -129,38 +142,6 @@ chmod +x hooks/post-receive Next time you push to that repository, the idle time should reset and show the correct value. -### Allowing clone via HTTPS - -If you want others to be able to clone your git repository, you might -need to enable the `git://` daemon or give public SSH access, both of -which have their cons. You can set up your NGINX server to call a git -subprogram that allows cloning anonymously via HTTP(S). - -To do this, add the following lines to your nginx server, above the -`location @cgit` line we added before: - -```nginx -location ~ /.+/(info/refs|git-upload-pack) { - include fastcgi_params; - fastcgi_param SCRIPT_FILENAME /usr/lib/git-core/git-http-backend; - fastcgi_param PATH_INFO $uri; - fastcgi_param GIT_HTTP_EXPORT_ALL 1; - fastcgi_param GIT_PROJECT_ROOT /srv/git; - fastcgi_param HOME /srv/git; - fastcgi_pass unix:/run/fcgiwrap.socket; -} -``` - -Note: `GIT_PROJECT_ROOT` and `HOME` must point to the location where -your repositories are stored. - -You can also add the `clone-prefix` setting to cgit so the clone URL -is shown for each repository: - -```txt -clone-prefix=https://git.example.org -``` - ## Contribution - Ariel Costas -- [website](https://costas.dev) |
