Sites like Github, Bitbucket, and GitLab make it ridiculously easy to setup public and private remote repos, which might make a lot of sense for your team. Sometimes there is an added cost to this though, whether financially or simply introducing another third-party dependency into your project.

Setting up your own git repo is easy and allows you to host your versioning system on your own server.

Getting started on the remote server

We'll need to set up a dedicated user to manage the repos.

  1. su - // Enter super user
  2. adduser git // Create the new user with home directory
  3. su git // Login as that user
  4. cd ~/ && mkdir .ssh
  5. cd .ssh
  6. touch authorized_keys

On the client

Optional: Installing ssh-copy-id

ssh-copy-id is a handy package that allows you to copy your local machine's public key to the authorized_keys file on the remote machine.

I use the homebrew package manager on macOS which, if you don't, you can find more information on at

brew install ssh-copy-id

  1. ssh-keygen -C "" // Generate a new rsa key
  2. ssh-copy-id <user@server> // Copies rsa keys to the authorized_keys file on the host
  3. mkdir gitDirectory // Create folder for wherever you'll want the git repo
  4. cd gitDirectory && git clone user@server:<repo.git>
  5. git pull origin <branch> // or do an initial commit and push it up to the server

Other notes:
To push a branch up to the server:

  1. git checkout -b feature_branch_name
  2. ... edit files, add and commit ...
  3. git push -u origin feature_branch_name

And that's it. You have a remote repo that you and your team can use, have full control over, and with no added cost. Happy coding!