I assume you have access to a Ubuntu Linux server that you can spin up or have one laying around your pad.
How do I set up a git server?
- Boot up a Linux Cloud Server.
- Configure user permissions.
- Install git-core.
- Profit.
You are probably saying what? That's it? Yup! That's really it to get started.
Boot up a Linux Cloud Server
Now that we have a server we can login and update all the packages.sudo apt-get update
sudo apt-get upgrade
Alright we will call this server my.gitserver.net
Configure user permissions
To configure the system my suggestion is to create a user called: git
sudo adduser git
Adding your public key to the server will allow you to bypass using a password.
This can be any username that can log into the server.
Install git-core
sudo apt-get install git-core
Easy right?
Setup git project
Login to the server as the git user and create the project.
ssh git@my.gitserver.net
mkdir super-secret-project.git
cd super-secret-project.git
git --bare init
Profit
So now we need our super secret project on a machine with some commits to push up to my.gitserver.net
mkdir super-secret-project
cd super-secret-project
git init
git remote add origin git@my.gitserver.net:super-secret-project.git
touch somefile.txt
git add somefile.txt
git commit -m "my first commit to my private git server"
git push origin master
Once we push the code up now that commit is now saved somewhere else.
Suggestions
- Always back up your data.
- Harden the security on your server
No comments:
Post a Comment