Files
coyote/assets/sbx-kit/files/home/.config/git/hooks/pre-commit
T
Dark-Alex-17 e76c3efe4e
CI / All (ubuntu-latest) (push) Failing after 26s
CI / All (macos-latest) (push) Has been cancelled
CI / All (windows-latest) (push) Has been cancelled
feat: integrated the git-ssh-sign kit into the coyote sandbox kit
2026-08-04 10:56:50 -06:00

22 lines
656 B
Bash
Executable File

#!/bin/sh
if [ -z "$SSH_AUTH_SOCK" ]; then
echo "WARNING: [git-ssh-sign] no SSH agent — cannot sign commits"
fi
KEY=$(ssh-add -L 2>/dev/null | head -1)
if [ -z "$KEY" ]; then
echo "WARNING: [git-ssh-sign] no keys in SSH agent — cannot sign commits"
fi
KEY_FILE="/home/agent/.config/git/signing_key.pub"
mkdir -p "$(dirname "$KEY_FILE")"
printf '%s\n' "$KEY" > "$KEY_FILE"
EMAIL=$(git config user.email 2>/dev/null || echo "agent@sandbox.local")
printf '%s %s\n' "$EMAIL" "$KEY" > "/home/agent/.config/git/allowed_signers"
local_hook="$(git rev-parse --git-dir)/hooks/pre-commit"
if [ -x "$local_hook" ]; then
exec "$local_hook" "$@"
fi