Git is one of the most popular version control system due to its speed, efficiency and support to a distributed development. Today LibreByte will shown how to sharing a git repository in read mode.
Step 1: Go to the DIR of the git repository
$ cd my-repo
Step 2: Create the file git-daemon-export-ok
The file git-daemon-export-ok is an empty file and its sole purpose is to inform git that this repository is available in read mode then the repo can be accessed using the git protocol. If the repo is not a bare repo (see – bare option from clone command) then you must create the file git-daemon-export-ok within the DIR .git
$ touch git-daemon-export-ok
Step 3: Run the git service
daemon /usr/bin/git - verbose - base-path = DIR-father-DE_MI-REPO - reuseaddr - detach
Step 4: Add to cron so that it starts when you start the OS
$ crontab - e
and then add the following line
@reboot /usr/bin/git daemon --base-path=PARENT_DIR-OF_MY-REPO --reuseaddr --detach
Recommended reading
-man git daemon
-man git clone
-man git