Yuup! What’s going on? On this article, we resume the first steps to do with your own git server. Don’t have any yet? Read this article.
Remember, any host with git software and internet connection can be a git server, you just need to configure a ssh connection to be able to use it.
You can install git on your raspberry pi, a virtual machine on your homelab, whatever you want, just install it!
Ok, right. Now you have the git software installed, but you need to create the repository first. How to do it? simple, just go to the folder where you want to put the repository (this directory needs to be accessible via ssh):
# change directory cd /home/cooluser/repositories/ # make new directory with .git extension mkdir coolrepo.git # come inside cd coolrepo.git # run the init command git init --bare
Create the directory where you want to have this repository
mkdir coolrepo cd coolrepo
Now, you need to prepare this directory for git:
git init touch README.md git add . git commit -m "First commit" -a git remote add origin ssh://[email protected]_ip:/home/cooluser/repositories/coolrepo.git git push origin master
Et voila, you have your own repository with full functionality.
In the future, you can do a
git clone like:
git clone [email protected]_ip:/home/cooluser/repositories/coolrepo.git