Host your own git

I host private git repos by myself. It’s easy!

Saying you have a server named “host123”. Create a user named “git”. Then setup ssh login without password from your local machine.

Create an repo on the server

ssh git@host123 'git init --bare project_name.git'

Point to the remote repo from a local directory

git remote add origin git@host123:project_name.git

Bind remote and local branches

I ususally work on the develop branch, so:

git checkout -b develop

Link the current branch with the remote “develop” branch.

git push origin develop -u