Github unfortunately does not offer private repositories without a paid account. But you can still set one up on your home server. My Jetson TX2 makes for a great low power server, hosting my home NAS. In this article, we’ll set up our own secure, private Git server to host various code, scripts, and configuration files.
Setting up Git Server
$ sudo adduser git
$ su git
$ mkdir .ssh && chmod 700 .ssh
$ touch .ssh/authorized_keys && chmod 600 .ssh/authorized_keys
Create git repository as the root user.
# mkdir /srv/git
# chown -R root:git /srv/git
# chmod -R 0774 /srv/git
Create project repository as the git user:
$ mkdir /srv/git/project.git
$ cd /srv/git/project.git
$ git init --bare
If any other repositories need to be created, login to the git user account and create them in the same way. Also, if the developer account does not have a cryptographic key yet, execute the following command (how do you not have an SSH key yet?):
# Do not enter a password, if you want passwordless access
Make the first commit as another user:
$ ssh-copy-id git@<server_hostname>
$ git clone git@<server_hostname>:/srv/git/project.git
$ touch test
$ git add test
$ git commit -a -m "commit test file"
$ git push
- Setup passwordless access to Git server over SSH.