Project

General

Profile

Actions

How to set up a git server over http(s) » History » Revision 1

Revision 1/17 | Next »
trevcan, 2022-05-08 19:36


How to set up a git server over http(s)

One may have already set up a git server, it's as easy as enabling ssh on a *NIX machine.

But one may have encountered the not-so-usual situation where you're on a random network
and you can't access port 22!.

This is a guide on how to set up a git over HTTP server.

Step 1: Permissions, permissions and more permissions!

See: https://redmine.lighttpd.net/projects/lighttpd/wiki/FrequentlyAskedQuestions#Why-do-I-get-403-Forbidden

Permissions are very important ! Remember that git will be performing reads and writes to directories and files ! Be sure to set up your user and group correctly. You may have to

chmod and chown

your git repo in order for it to be accessible to your user. You cannot change user/group at runtime of lighttpd.

In most cases, users will have the

www-data

user and group for lighttpd. This is fine, as long as you change all your git repos and chown/chmod them.

You can use these commands to change ownership and file modes of files.

# assumes root
cd /var/www/git/
chown --recursive git:www-data *.git
chmod --recursive u=rwx,g=rwx *.git

This will make it a shared repo between the `git` and `www-data` user. It will recursively modify all files under folders ending with ".git" in order to let
the group read, write, and execute.

Updated by trevcan almost 2 years ago · 1 revisions