git-secure-export

Experimental tooling for encrypting the git-fast-export(1) output

git clone https://git.8pit.net/git-secure-export.git

 1package main
 2
 3import (
 4	"fmt"
 5	"log"
 6	"os"
 7	"path/filepath"
 8
 9	git "github.com/nmeum/git-secure-export"
10)
11
12func main() {
13	log.SetFlags(log.Lshortfile)
14
15	gitDir, err := git.GetDir()
16	if err != nil {
17		log.Fatal(err)
18	}
19	keyPath := filepath.Join(gitDir, "git-secure-key")
20
21	_, err = os.Stat(keyPath)
22	if !os.IsNotExist(err) {
23		log.Fatalf("key file %q already exists\n", keyPath)
24	}
25	err = git.CreateKey(keyPath)
26	if err != nil {
27		log.Fatal("key creation failed:", err)
28	}
29
30	fmt.Printf("Initialized symmetric key in %s\n", keyPath)
31}