snippets/old_snippets/git-repo-backup.en.md

39 lines
942 B
Markdown

---
title: "git repo backup"
date: 2020-02-23T10:14:44+01:00
draft: false
snippet_types: ["git", "pass"]
---
Backup a git repo without thats not hosted on remote repo with:
```shell
$ git bundle create /tmp/pass_"$(date +%s)".bundle --all
```
Then to confirm bundle:
```shell
$ git bundle verify /tmp/pass_1582448923.bundle
```
When you need to restore the backup into a new repo folder:
```shell
$ git clone -b master /tmp/pass_1582448923.bundle newrepo
```
I recently used this to backup my *~/.pass-store* [pass](https://www.passwordstore.org/)
repo. Basically it's a folder full of **.gpg** files each encrypting a password. Don't want to store
it on a remote host so I back it up locally. Create a git bundle then I encrypt the resulting bundle
file and store it somewhere safe.
```shell
$ gpg --symmetric ./pass_1582448923.bundle
```
source:
[git-memo docs](https://git-memo.readthedocs.io/en/latest/repository_backup.html)