diy git remote on nas storage - 06-26-22

Got a repo with sensitive data you don’t want to push to a remote server you don’t control? Have a NAS setup on our home network? Here is how to setup a folder on that NAS to act as a git remote.

*Step 1:

Change directorys to the NAS and clone the local folder with the –bare option.

$ cd /Volumes/travis/git
$ git clone --bare ~/.password-store

This creates /Volumes/travis/git/.password-store but without a working directory. Basically its just the /.git part of the repo.

Step 2:

Setup the NAS file path to be a git remote on the repo.

$ cd ~/.password-store
$ git remote add nas /Volumes/travis/git/travisshears.com.git
...

Step 3:

Done. Now jus push.

$ git push nas
Enumerating objects: 8, done.
Counting objects: 100% (8/8), done.
Delta compression using up to 10 threads
Compressing objects: 100% (5/5), done.
Writing objects: 100% (5/5), 1.30 KiB | 1.30 MiB/s, done.
\- [ git, nas ]