devpod icon indicating copy to clipboard operation
devpod copied to clipboard

SSH Commit signing not working - unknown shorthand flag: 'U' in -U

Open BigGold1310 opened this issue 10 months ago • 3 comments

What happened?
While trying to sign a git commit with an SSH key the following error was encountered:

error: ?[0;1;37m18:58:54 ?[0m?[0;1;31merror ?[0mTry using the --debug flag to see a more verbose output
?[0;1;37m18:58:54 ?[0m?[0;1;31mfatal ?[0munknown shorthand flag: 'U' in -U

fatal: failed to write commit object

What did you expect to happen instead?
A commit gets successfully signed with an SSH key using the forwarded ssh agent.

How can we reproduce the bug? (as minimally and precisely as possible)

My devcontainer.json:

{
  "name": "Development Container",
  "image": "mcr.microsoft.com/devcontainers/base:ubuntu"
}

Local Environment:

  • DevPod Version: v0.6.15
  • Operating System: mac
  • ARCH of the OS: ARM64

DevPod Provider:

  • Local/remote provider: docker

Anything else we need to know?
DevPod ~/.gitconfig:

[user]
        name = User Name
        email = [email protected]
[credential]
        helper = !'/usr/local/bin/devpod' agent git-credentials --port 12049
[gpg "ssh"]
        program = devpod-ssh-signature
[gpg]
        format = ssh
[user]
        signingkey = ssh-ed25519 A<truncated>s

Trying to sign a commit results in the error:

$ git commit --amend -s -S
error: ?[0;1;37m18:58:54 ?[0m?[0;1;31merror ?[0mTry using the --debug flag to see a more verbose output
?[0;1;37m18:58:54 ?[0m?[0;1;31mfatal ?[0munknown shorthand flag: 'U' in -U

fatal: failed to write commit object

Running git in trace mode:

$ GIT_CURL_VERBOSE=1 GIT_TRACE=1 git commit --amend -s -S 
19:08:17.546494 git.c:479               trace: built-in: git commit --amend -s -S
hint: Waiting for your editor to close the file... 19:08:17.564423 run-command.c:666       trace: run_command: GIT_INDEX_FILE=.git/index 'code --wait' /workspaces/zion/.git/COMMIT_EDITMSG
19:08:17.564437 run-command.c:758       trace: start_command: /bin/sh -c 'code --wait "$@"' 'code --wait' /workspaces/zion/.git/COMMIT_EDITMSG
19:08:20.625044 run-command.c:666       trace: run_command: devpod-ssh-signature -Y sign -n git -f /tmp/.git_signing_key_tmpvLhjbc -U /tmp/.git_signing_buffer_tmppwGIOt
19:08:20.625103 run-command.c:758       trace: start_command: /usr/local/bin/devpod-ssh-signature -Y sign -n git -f /tmp/.git_signing_key_tmpvLhjbc -U /tmp/.git_signing_buffer_tmppwGIOt
error: ?[0;1;37m19:08:20 ?[0m?[0;1;31merror ?[0mTry using the --debug flag to see a more verbose output
?[0;1;37m19:08:20 ?[0m?[0;1;31mfatal ?[0munknown shorthand flag: 'U' in -U

fatal: failed to write commit object

BigGold1310 avatar Mar 27 '25 19:03 BigGold1310

Bump, needs a fix.

As a workaround removing gpg.ssh.program via git config --unset --global gpg.ssh.program solves the issue

Nelfimov avatar May 05 '25 12:05 Nelfimov

This issue is stale because it has been open for 60 days with no activity.

github-actions[bot] avatar Jul 05 '25 02:07 github-actions[bot]

I've just started using devpod and ran into this problem. I also want to call out that somehow I've seen the setting come back regardless of container restarts, which makes things super annoying.

Here's what I'm doing as part of my devcontainer.json's postCreateCommand script:

# Add persistent fix for DevPod's broken SSH signature wrapper (GitHub issue #1803)
# DevPod re-adds gpg.ssh.program after setup, so remove it on every shell startup
if [ -f ~/.zshrc ] && ! grep -q 'Remove DevPod broken SSH wrapper' ~/.zshrc; then
  echo "" >>~/.zshrc
  echo "# Remove DevPod broken SSH wrapper (runs on every shell startup)" >>~/.zshrc
  echo "# See: https://github.com/loft-sh/devpod/issues/1803" >>~/.zshrc
  echo 'git config --global --unset gpg.ssh.program 2>/dev/null || true' >>~/.zshrc
  echo "✓ Added persistent DevPod SSH wrapper removal to .zshrc"
fi

fgrehm avatar Nov 06 '25 14:11 fgrehm