Repository navigation
[Bug]: Default Git SSH signing relay fails with a ~/ private-key path #1723
Description
What happened?
Git SSH signing fails inside a Linux workspace when the macOS host uses:
[user]
signingkey = ~/.ssh/git_signing_ed25519
[gpg]
format = ssh
[commit]
gpgsign = trueThe host and workspace use the same dotfiles, and the configured file is an OpenSSH private key in both environments. This setup uses private-key files directly, without an SSH agent.
Devsy’s SSH signing forwarding is enabled by default. The workspace’s effective gpg.ssh.program is devsy-ssh-signature.
The failure reproduces in a temporary Git repository, independently of the original project and its pre-commit hooks.
Changing the macOS host’s user.signingkey to its absolute private-key path made the same test succeed:
[user]
signingkey = /Users/<user>/.ssh/git_signing_ed25519What did you expect to happen instead?
The default signing relay should support the host’s valid Git SSH signing configuration, including a private-key path using ~/.
Git explicitly supports private-key paths in user.signingkey; an SSH agent is not required for this mode.
Steps to reproduce
- On macOS, configure Git as shown above, using a valid, unencrypted OpenSSH private key. Use disposable keys when reproducing.
- Apply the same dotfiles to a Linux workspace, with the private key present at the corresponding workspace path.
- Connect through Devsy with its default SSH signing forwarding.
- Run this Bash command inside the workspace. It creates and removes a temporary repository without modifying the current repository:
( sign_test_dir=$(mktemp -d) || exit; trap 'rm -rf -- "$sign_test_dir"' EXIT; git init -q "$sign_test_dir" && git -C "$sign_test_dir" -c user.name='Signing Test' -c user.email=signing-test@example.invalid commit-tree -S -m 'Signing test' "$(git -C "$sign_test_dir" mktree </dev/null)" >/dev/null && echo 'Signing OK' )- Observe the signing failure.
- Change the macOS host’s
user.signingkeyto the absolute path of the same private key. - Run the same test again. It prints:
Signing OK
Error output / logs
The nested error, with the temporary path shortened:
signature server returned 500:
rpc error: code = Unknown desc = get git ssh signature:
failed to sign commit: exit status 255
stderr:
Couldn't load public key /var/folders/.../T/.git_signing_key_3611075085:
No such file or directory
How often does this happen?
Repeatedly with the ~/ configuration. The same temporary-repository test succeeded after changing the host configuration to an absolute path.
Environment
- Devsy host CLI:
v1.25.0-beta.3 - Host: macOS, ARM64
- Workspace: Linux
- Interface: CLI
- SSH agent: not used
Anything else?
Source inspection suggests the following failure mechanism:
- Git expands
~using the workspace’s home directory. createSignatureRequestBodyreads the workspace-local file, appliesstrings.TrimSpace, and sends its contents asPublicKey, without checking whether it is a public or private key.- The host writes those contents to a temporary file and invokes
ssh-keygen.
In a separate macOS experiment with a disposable OpenSSH private key, preserving the trailing newline allowed signing without an agent. Removing it reproduced the same error, even though the temporary file existed.
This supports the newline-corruption explanation, but the failed relay request’s temporary file was not captured directly.
The existing SSH signing E2E covers public-key paths with an SSH agent. It does not cover this private-key, shared-dotfiles configuration without an agent.
Using an absolute host private-key path is a verified workaround.
Thanks for all the recent work on Devsy, @skevetter! Given how actively development is moving, I thought reporting this as an issue would make it easier to fit into the ongoing work than opening a PR myself.
Activity
[-][Bug]: Default Git SSH signing relay fails with a `~/` private-key path; absolute host path works[/-][+][Bug]: Default Git SSH signing relay fails with a `~/` private-key path[/+]