snippets/old_snippets/diy-git-remote-on-nas.en.md

46 lines
1.1 KiB
Markdown

---
title: "diy git remote on nas storage"
seo_description: "How to setup a folder on a network attached storage drive to be a remote git repo."
date: 2022-06-26T15:57:58+02:00
draft: false
snippet_types:
- git
- nas
---
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.
```shell
$ 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.
```shell
$ cd ~/.password-store
$ git remote add nas /Volumes/travis/git/travisshears.com.git
...
```
**Step 3:**
Done. Now jus push.
```shell
$ 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.
```