"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." (cited from https://git-scm.com).
This document will describe how to install a git repository within a container. The repository can be access via no authentication at all or via SSH.
Upload and configure the git container on your router. Bridge the container to an IP net that has access to the internet. Enter the container as root and set prepare everything for a new repository.
First of all change the password of root:
root@container_git ~ $ passwd
Then create a new user named "user" and enter a password:
root@container_git ~ $ adduser -G users user
Let the user have access to /dev/null:
root@container_git ~ $ chmod 666 /dev/null
From this point on it's not necessary to have root permissions any more. Log out and log in as "user" or become user with su:
root@container_git ~ $ su user
Create a new directory where the new repository should exist:
root@container_git ~ $ mkdir ~/repo
root@container_git ~ $ cd ~/repo
Configure the users name an E-Mail address of this master repository:
root@container_git ~ $ git config --global user.email "you@example.com"
root@container_git ~ $ git config --global user.name "Your Name"
Create the repository itself. It will be a bare repo without any files. This directory will only hold the repository database, no source files. The sources will be created on other machines, after they clone this repo.
root@container_git ~ $ git init --bare
Optionally start the git daemon, so that other users on other machines can clone this repository without any authentication. This is only recommended for friendly LANs. Do NOT use this when you want to avoid that the whole mankind can modify your repository:
root@container_git ~ $ git daemon --reuseaddr --base-path=/home/user --export-all --enable=receive-pack --verbose
In case this git daemon should be started automatically after the container starts, append this line in finit.conf:
service /bin/git daemon --reuseaddr --base-path=/home/user --export-all --enable=receive-pack
On another machine (most likely your PC) the repository can be cloned. It is assumed that the containers IP address is 192.168.1.3:
joe@pc ~ $ git clone git://192.168.1.3/repo
Enter the fresh repository and create a file there:
joe@pc ~ $ cd repo
joe@pc ~ $ echo "This is the first file of the repository" > first_file.txt
Add the new file to the repo and push it to the bare repo within the container:
joe@pc ~ $ git add first_file.txt
joe@pc ~ $ git commit -am "first_file.txt has been added
joe@pc ~ $ git push
On another machine (most likely your PC) the repository can be cloned. It is assumed that the containers IP address is 192.168.1.3:
joe@pc ~ $ git clone ssh://user@192.168.1.3:/home/user/repo
Enter the fresh repository and create a file there:
joe@pc ~ $ cd repo
joe@pc ~ $ echo "This is the first file of the repository" > first_file.txt
Add the new file to the repo and push it to the bare repo within the container:
joe@pc ~ $ git add first_file.txt
joe@pc ~ $ git commit -am "first_file.txt has been added
joe@pc ~ $ git push