Git - HVboom/HowTo-DigitalOcean GitHub Wiki
Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency.
💬 copied from package description
-
Install the Git package:
sudo pkg install git ... > ===> Creating users and/or groups. > Creating group 'git_daemon' with gid '964'. > Creating user 'git_daemon' with uid '964'. > [12/12] Extracting git-2.4.6: 100% > Updating /etc/shells > Message for git-2.4.6: > ------------------------------------------------------------------------ > *************************** GITWEB ************************************* > If you installed the GITWEB option please follow these instructions: > > In the directory /usr/local/share/examples/git/gitweb you can find all files to > make gitweb work as a public repository on the web. > > All you have to do to make gitweb work is: > 1) Copy the files /usr/local/share/examples/git/gitweb/* to a directory on > your web server (e.g. Apache2) in which you are able to execute > CGI-scripts. > 2) In gitweb.cgi, adjust the variable $projectroot to point to > your git repository (that is where you have your *.git project > directories). > *************************** GITWEB ************************************* > > *************************** CONTRIB ************************************ > If you installed the CONTRIB option please note that the scripts are > installed in /usr/local/share/git-core/contrib. Some of them require > other ports to be installed (perl, python, etc), which you may need to > install manually. > *************************** CONTRIB ************************************ > ------------------------------------------------------------------------
- Currently GitWeb is not installed
-
Use a dedicate user to host your own repositories:
# -n = <user name> # -g = <primary group> (optional) - default: creating a new group with the same name as the user # -G = <list of secondary groups> (optional): group _wheel_ allows _sudo_ commands # -m = create a home directory # -d = <home directory> (optional) - default: /home/<user name> # -c = <comment> (optional) # -s = <login shell>: must be defined in _/etc/shells_ # -k = <directory of skeleton dot files>: use _/var/empty_ to not create any dot files # -h - = <disable password based login> # -w yes = <password is the same as the user name> #sudo pw useradd -n git -m -k /var/empty -c GitLab -s /usr/local/libexec/git-core/git-shell -h - # We will start with a user allowed to _sudo_ and secure the access once GitLab is installed sudo pw useradd -n git -G wheel -m -k /var/empty -c GitLab -s /usr/local/bin/bash -w yes
-
All repositories can be maintained with GitLab
-
Secure git user after successful GitLab installation
Currently not possible to restrict the shell, because than the .profile is not sourced and therefore the PATH environment variable does not have /usr/local/bin included. Without this the bash shell is not found, which is necessary for GitLab to run.
# restrict shell # chsh -s /usr/local/libexec/git-core/git-shell # currently no interactive shell needed (see https://git-scm.com/docs/git-shell) mkdir -p ~git/git-shell-commands cat >~git/git-shell-commands/no-interactive-login <<\EOF #!/bin/sh printf '\n%s\n' "Hi $USER!" printf '%s\n' "You've successfully authenticated, but I do not" printf '%s\n\n' "provide interactive shell access." exit 128 EOF chmod +x ~git/git-shell-commands/no-interactive-login # revoke login with a password sudo pw usermod git -w no # remove sudo access sudo pw usermod git -g wheel