Self-hosted Git using SSH

Most of my Git needs are met by GitHub (public) and BitBucket (private), but occasionally I want to hold confidential data on a server which I control. There are self-hosted options available, such as GitLab, but they are overkill for a simple private repository with single user access.

Fortunately, Git supports the existing SSH protocol, and setting up a new repository is a matter of running one command on the server and two on the client.

On the server:

git init --bare ~/project.git

On the client:

git init project
git remote add origin user@server:project.git

That’s it! Access control is managed via SSH, so you can use passwords, keys, restrict by IP address etc.

Comments

No comments yet. Why don’t you start the discussion?

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.