Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions backend/git.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,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"
)

Expand Down Expand Up @@ -438,6 +439,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 {
Expand Down
113 changes: 113 additions & 0 deletions docs/guide/contributing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
---
description: Contributing to scrt — how to build from source, run tests, and verify changes locally.
---

# Contributing <!-- omit in toc -->

- [Prerequisites](#prerequisites)
- [Clone a fork of the Repository](#clone-a-fork-of-the-repository)
- [Build](#build)
- [Run Tests](#run-tests)
- [Install Locally](#install-locally)
- [Lint Docs](#lint-docs)
- [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/loderunner/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`.

## 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:**

```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:<user>/<repo>.git \
--git-path=store.scrt \
--verbose
```

**Clean up test artifacts:**

```bash
rm -f test.scrt
```
Loading