# Setting up source hosting NB! Some system-specific strings are used which you may need to adapt depending on your local setup: featureroot: /usr/local/share/redpill/source-hosting githost: {{githost}} ## Prerequisites Gitolite service need to know the public SSH key of its administrator. You can let it ask during install, but it may be more convenient to preconfigure that information instead. **On your local host**, print your SSH public key e.g. with this command **from your personal system** (adapt to replace ed25519 if your SSH keypair use a different algorithm): cat ~/.ssh/id_ed25519.pub **On the server**, preconfigure git user with above public key (the whole line without newline) as $YOURKEY, and install needed packages: echo gitolite3 gitolite3/adminkey select "$YOURKEY" | sudo debconf-set-selections echo gitolite3 gitolite3/gituser select git | sudo debconf-set-selections sudo apt install gitolite3 myrepos git-daemon-sysvinit cgit cmark highlight ## Configure git access **On your local host**, Clone the gitolite3 settings repository: git clone git@{{githost}}:gitolite-admin **On your local host**, edit the file gitolite.conf, e.g. add these likes to add repository "foobar": FIXME ## Enable hook This is all done **On the server**. Clone the redpill feature project for source-hosting and register with myrepos (to ease later update): sudo mkdir --parents /usr/local/share/redpill cd /usr/local/share/redpill sudo git clone https://source.redpill.dk/source-hosting.git cd source-hosting sudo mr reg Edit the file `/etc/gitolite3/gitolite.rc` to have `LOCAL_CODE` point into the project cloned above, i.e. the line should look like this: LOCAL_CODE => "/usr/local/share/redpill/source-hosting/lib/gitolite3", Refresh gitolite setup by running this command: sudo -u git gitolite setup ## Web export FIXME: move to separate feature **On the server**, grant access for gitolite to write below /var/www with these commands: sudo mkdir /var/www/gitolite3 sudo chown git:www-data /var/www/gitolite3 **On your local host**, edit the file gitolite.conf to add FIXME to repos that should be exported for web publishing, e.g. add these likes to add repository "foobar": FIXME ## Configure web access This is all done **On the server**. Adapt the file `/etc/default/git-daemon`: GIT_DAEMON_ENABLE=true GIT_DAEMON_USER=gitdaemon GIT_DAEMON_BASE_PATH=/srv/git GIT_DAEMON_DIRECTORY=/srv/git/{{githost}} # Additional options that are passed to the Daemon. GIT_DAEMON_OPTIONS="--interpolated-path=/srv/git/%H/%D --user-path=public_git --export-all" Adapt the file `/etc/cgitrc`: css=/cgit-css/cgit.css logo=/cgit-css/cgit.png include=/usr/local/share/redpill/source-hosting/etc/cgitrc