From b4be4cf14b3f4fc45237b135bfba14ebff5e41ec Mon Sep 17 00:00:00 2001 From: Bruce Dubbs Date: Fri, 8 Jan 2021 18:46:05 +0000 Subject: [PATCH] More tweaks to git server page git-svn-id: svn://svn.linuxfromscratch.org/BLFS/trunk/BOOK@24092 af4574ff-66df-0310-9fd7-8a98e5e911e0 --- general/prog/gitserver.xml | 35 +++++++++++++++++++++++++++++------ 1 file changed, 29 insertions(+), 6 deletions(-) diff --git a/general/prog/gitserver.xml b/general/prog/gitserver.xml index c4c4e39d46..bf1f9980e7 100644 --- a/general/prog/gitserver.xml +++ b/general/prog/gitserver.xml @@ -76,7 +76,7 @@ install -o git -g git -m0600 /dev/null /home/git/.ssh/authorized_keys For any developer who should have access to the repository add his/her public ssh key to /home/git/.ssh/authorized_keys. - First, prepend some options to prevent users to use the + First, prepend some options to prevent users from using the connection to git for port forwarding to other machines the git server might reach. @@ -116,6 +116,14 @@ cat <user-ssh-key> >> /home/git/.ssh/authorized_keysroot user): + + + In all the instructions below, we use project1 + as an example repository name. You should name your repository + as a short descriptive name for your specific project. + + + install -o git -g git -m755 -d /srv/git/project1.git && cd /srv/git/project1.git && git init --bare && @@ -126,6 +134,13 @@ chown -R git:git . 3. Populate the repository from a client system + + + All the instructions in this section and the next should + be done on a user system, not the server system. + + + Now that the repository is created, it can be used by the developers to put some files into it. Once the ssh key of @@ -150,6 +165,13 @@ EOF to the repository as the initial content: + + + The gitserver term used below + should be the host name (or ip address) of the git server. + + + mkdir myproject cd myproject git init --initial-branch=trunk @@ -198,7 +220,8 @@ git push Access is restricted by the public keys added to git's authorized_keys file and there is no option for the public to export/clone the repository. To - enable this, continue with step 4 to setup the git server. + enable this, continue with step 4 to set up the git server + for public read-only access. @@ -209,7 +232,7 @@ git push The setup described above makes a repository available for authenticated users (via providing the ssh public key file). - There is also a quite simple way to publish the + There is also a simple way to publish the repository to unauthenticated users - of course without write access. @@ -252,7 +275,7 @@ git push make install-git-daemon - In order to make git exporting a + In order to allow git to export a repository, a file named git-daemon-export-ok is required in each repository directory on the server. The file needs no content, just its existance enables, its absence @@ -262,10 +285,10 @@ git push touch /srv/git/project1.git/git-daemon-export-ok - Also review the configuration file + Finally, review the configuration file /etc/sysconfig/git-daemon /etc/default/git-daemon - for valid repository paths. + for valid repository paths and change them as appropriate.