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 -yIn the console or an ssh window, do the following:
Install Git
apt install gitCreate a Git User
adduser gitYou need to give the user a password
Create a Repository
mkdir /usr/local/gitChange the ownership of the directory to the git user
chown git:git /usr/local/gitSwitch to the git user
su -l gitInitialize a new bare repository
git init –bare mystuff.gitConfigure SSH access for the git user
mkdir .ssh && chmod 700 .ssh
touch .ssh/authorized_keys && chmod 600 .ssh/authorized_keysAdd 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_keysClone the repository to the server
git clone git@<server>:/usr/local/git/mystuff.git<server> a FQDN or an IP address
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.gitGenerate an SSH key pair
ssh-keygen -t ed25519 -C “[email protected]” -f ~/.ssh/mykeys/git_keyUsing the ssh-keygen command
-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_keyand the corresponding public keygit_key.pubis generated in the same directory. The directory must exist.
Print out the public key and copy it.
cat ~/.ssh/mykeys/git_key.pub