From 91dce8f0a6fe91ed1f32f63c16b5f6d23f806775 Mon Sep 17 00:00:00 2001 From: Daniel Olshansky Date: Sun, 8 Mar 2026 14:55:15 -0700 Subject: [PATCH 1/4] fix(git): expand tilde in SSH identity file paths SSH identity file paths from ~/.ssh/config contain literal ~ which was not expanded to the home directory, causing "no valid authentication method" errors. Uses go-homedir (already a dependency) to expand paths before passing to go-git's SSH auth. Also adds a contributing guide with build/test/verify instructions. Co-Authored-By: Claude Opus 4.6 --- backend/git.go | 6 +++ docs/guide/contributing.md | 98 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 104 insertions(+) create mode 100644 docs/guide/contributing.md diff --git a/backend/git.go b/backend/git.go index e7fc87ff..cfe2291d 100644 --- a/backend/git.go +++ b/backend/git.go @@ -22,6 +22,8 @@ import ( "os" "time" + homedir "github.com/mitchellh/go-homedir" + "github.com/go-git/go-billy/v5" "github.com/go-git/go-billy/v5/memfs" "github.com/go-git/go-git/v5" @@ -409,6 +411,10 @@ func buildAuths(ctx context.Context, url string) ([]ssh.AuthMethod, error) { idFiles := sshConfig.GetAll(e.Host, "IdentityFile") for _, idFile := range idFiles { + idFile, err := homedir.Expand(idFile) + if err != nil { + continue + } logger := logger.WithField("identity_file", idFile) publicKeyAuth, err := ssh.NewPublicKeysFromFile(e.User, idFile, "") if err == nil { diff --git a/docs/guide/contributing.md b/docs/guide/contributing.md new file mode 100644 index 00000000..183ad813 --- /dev/null +++ b/docs/guide/contributing.md @@ -0,0 +1,98 @@ +--- +description: Contributing to scrt — how to build from source, run tests, and verify changes locally. +--- + +# Contributing + +- [Prerequisites](#prerequisites) +- [Clone a fork of the Repository](#clone-a-fork-of-the-repository) +- [Build](#build) +- [Run Tests](#run-tests) +- [Install Locally](#install-locally) +- [Verify Your Changes](#verify-your-changes) + +## Prerequisites + +- Go >= 1.18 +- Git +- SSH key configured for GitHub (if testing git storage) + +## Clone a fork of the Repository + +```bash +git clone https://github.com//scrt.git +``` + +```bash +cd scrt +``` + +## Build + +**Compile without producing a binary** (useful for quick syntax/type checks): + +```bash +go build ./... +``` + +**Build the binary:** + +```bash +go build -o scrt . +``` + +The binary will be at `./scrt` in the repository root. + +## Run Tests + +```bash +go test ./... +``` + +## Install Locally + +**Option A — Replace the Homebrew binary (macOS):** + +```bash +cp scrt /opt/homebrew/bin/scrt +``` + +**Option B — Install to `$GOPATH/bin`:** + +```bash +go install . +``` + +Make sure `$GOPATH/bin` is in your `$PATH`. + +## Verify Your Changes + +**Quick smoke test with local storage:** + +```bash +./scrt init --storage=local --password=test --local-path=test.scrt +``` + +```bash +./scrt set --storage=local --password=test --local-path=test.scrt mykey "myvalue" +``` + +```bash +./scrt get --storage=local --password=test --local-path=test.scrt mykey +``` + +**Test with git storage:** + +```bash +./scrt init --storage=git \ + --password=test \ + --git-url=git@github.com:/.git \ + --git-path=store.scrt \ + --verbose +``` + +**Clean up test artifacts:** + +```bash +rm -f test.scrt +``` From f2964005975d4275675002dbaf7baff43d97b26f Mon Sep 17 00:00:00 2001 From: Daniel Olshansky Date: Tue, 10 Mar 2026 10:10:45 -0700 Subject: [PATCH 2/4] Update docs/guide/contributing.md Co-authored-by: Charles Francoise --- docs/guide/contributing.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/docs/guide/contributing.md b/docs/guide/contributing.md index 183ad813..fe72958c 100644 --- a/docs/guide/contributing.md +++ b/docs/guide/contributing.md @@ -20,8 +20,7 @@ description: Contributing to scrt — how to build from source, run tests, and v ## Clone a fork of the Repository ```bash -git clone https://github.com//scrt.git -``` +git clone https://github.com/loderunner/scrt.git ```bash cd scrt From f8b5ef9a7d10db6d7a63f17af977b7884ec3fc0d Mon Sep 17 00:00:00 2001 From: Daniel Olshansky Date: Thu, 12 Mar 2026 10:33:54 -0700 Subject: [PATCH 3/4] Fix the linter --- docs/guide/contributing.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/docs/guide/contributing.md b/docs/guide/contributing.md index fe72958c..a4487d36 100644 --- a/docs/guide/contributing.md +++ b/docs/guide/contributing.md @@ -9,6 +9,7 @@ description: Contributing to scrt — how to build from source, run tests, and v - [Build](#build) - [Run Tests](#run-tests) - [Install Locally](#install-locally) +- [Lint Docs](#lint-docs) - [Verify Your Changes](#verify-your-changes) ## Prerequisites @@ -21,6 +22,7 @@ description: Contributing to scrt — how to build from source, run tests, and v ```bash git clone https://github.com/loderunner/scrt.git +``` ```bash cd scrt @@ -64,6 +66,20 @@ go install . Make sure `$GOPATH/bin` is in your `$PATH`. +## Lint Docs + +CI runs prettier and eslint on the `docs/` directory. Run the linter locally before pushing: + +```bash +cd docs && npm run lint +``` + +**Auto-fix formatting issues:** + +```bash +cd docs && npx prettier --write . +``` + ## Verify Your Changes **Quick smoke test with local storage:** From 70cc82e4173005efea55baed46350e39f07d452a Mon Sep 17 00:00:00 2001 From: Daniel Olshansky Date: Thu, 12 Mar 2026 20:47:58 -0700 Subject: [PATCH 4/4] Order imports --- backend/git.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/backend/git.go b/backend/git.go index ffcfc390..24854952 100644 --- a/backend/git.go +++ b/backend/git.go @@ -22,8 +22,6 @@ import ( "os" "time" - homedir "github.com/mitchellh/go-homedir" - "github.com/go-git/go-billy/v5" "github.com/go-git/go-billy/v5/memfs" "github.com/go-git/go-git/v5" @@ -34,6 +32,7 @@ import ( "github.com/go-git/go-git/v5/plumbing/transport/ssh" "github.com/go-git/go-git/v5/storage/memory" "github.com/kevinburke/ssh_config" + homedir "github.com/mitchellh/go-homedir" "github.com/spf13/pflag" )