Create an Internal GIT Server
Everyone needs Git Servers. A safe place for your GIT stuff in the home lab.
Create a Git server
First set up a CT (Ubuntu 22.04) with standard settings, yes 512 RAM is plenty and 8G should be ok for your projects. Start your CT and update it to latest.
apt update && apt dist-upgrade -y
In the console or an ssh window, do the following:
Install Git
apt install git
Create a Git User
Create a Repository
mkdir /usr/local/git
Change the ownership of the directory to the git user
chown git:git /usr/local/git
Switch to the git user
su -l git
Initialize a new bare repository
git init –bare mystuff.git
Configure SSH access for the git user
mkdir .ssh && chmod 700 .ssh
touch .ssh/authorized_keys && chmod 600 .ssh/authorized_keys
Add SSH public keys to the authorized_keys file
Create a key <my new key> for use with this git and cat <my new key>.
Use ED25519 keys, they are more secure and shorter.
nano ~/.ssh/authorized_keys
Clone the repository to the server
Start using the Internal Git Server
Copy your stuff to the internal Git Server for all your users to use.
git clone git@<server>:/usr/local/git/mystuff.git
Generate an SSH key pair
-C “[email protected]”
A comment is appended to the end of the public key file to easily identify it.
Normally, an email address is used for the comment, but use whatever works best for you.-f ~/.ssh/mykeys/git_key
Filename of the private key file, if you choose not to use the default name.
Two files are created, the private keygit_key
and the corresponding public keygit_key.pub
is generated in the same directory. The directory must exist.
Print out the public key and copy it.
cat ~/.ssh/mykeys/git_key.pub