Dev Container: git commit fails because GPG can’t be found inside the container

Describe the Bug

When I work inside a Dev Container opened with anysphere.remote-containers v1.0.17, every git commit (invoked via Cursor’s Source Control UI) fails:

git -c user.useConfigOnly=true commit --quiet --allow-empty-message --file -
fatal: cannot exec ‘/opt/homebrew/bin/gpg’: No such file or directory
error: gpg failed to sign the data:
(no gpg output)
fatal: failed to write commit object

The container inherits my global ~/.gitconfig, which specifies a host-only GPG path (/opt/homebrew/bin/gpg). Because that binary is absent inside the container, Git aborts and Cursor cannot create commits.

Steps to Reproduce

  1. On macOS host, ensure global GPG-signed commits are enabled (see .gitconfig excerpt below).
  2. Open any project in a Dev Container using anysphere.remote-containers.
  3. In Cursor’s Source Control panel (or terminal), run Commit.
  4. Commit immediately fails with the error shown above.

Expected Behavior

git commit should succeed and be signed with GPG (or fall back gracefully) inside the Dev Container, just as it does on the host.

Operating System

MacOS

Current Cursor Version (Menu → About Cursor → Copy)

版本: 1.2.4
提交: 1.99.3
日期: a8e95743c5268be73767c46944a71f4465d05c90
Electron: 2025-07-10T16:53:59.659Z
ElectronBuildId: 34.5.1
Chromium: undefined
Node.js: 132.0.6834.210
V8: 20.19.0
OS: 13.2.152.41-electron.0

Additional Information

~/.gitconfig (on host)
[filter “lfs”]
required = true
clean = git-lfs clean – %f
smudge = git-lfs smudge – %f
process = git-lfs filter-process
[user]
name = Jacky
email = [email protected]
signingkey = ************
[commit]
gpgsign = true
[url “ssh://[email protected]/”]
insteadOf = https://github.com/
[pull]
rebase = true
[gpg]
program = /opt/homebrew/bin/gpg # ← not present inside container

Does this stop you from using Cursor

Yes - Cursor is unusable

1 Like

I have the same problem.

Hi @0xJacky and @MuhammetDilmac, could try setting the “Copy Git Config” setting to false?

This will only affect newly built containers. For existing containers, you’ll need to manually modify the copied .gitconfig.

Alternatively, would it work to use a relative path for gpg, or set the setting git config --global commit.gpgsign false as part of a post-attach initialization script?

@ravirahman, thanks for the suggestion, but I want to sign the commits. Why do I disable this? The previous version worked with GPG signing.

Hi @MuhammetDilmac and @0xJacky, we have fixed this issue in version 1.0.22 of the extension. We implemented similar functionality is the VSCode extension, where we’ll unset this key from the .gitconfig if it is not present in the container (see git config gpg.program should not be copied into devcontainer. · Issue #6978 · microsoft/vscode-remote-release). Could you try upgrading to the latest version?

You will need to rebuild the container for this change to take effect; we do not modify the .gitconfig file in existing containers.

Thank you for bringing this to our attention.

Hi @ravirahman, Thank you for your fix. I updated the dev container to version 1.0.22 and rebuilt the container without caching. I checked the .gitconfig file and indeed there is no “gpg” section now. However, I still cannot commit the signed commit. The output is as follows:

git -c user.useConfigOnly=true commit --quiet --allow-empty-message --file -
error: gpg failed to sign the data:
gpg: skipped “215C21B10DF38B4D”: No secret key
[GNUPG:] INV_SGNR 9 215C21B10DF38B4D
[GNUPG:] FAILURE sign 17
gpg: signing failed: No secret key

fatal: failed to write commit object

This topic was automatically closed 22 days after the last reply. New replies are no longer allowed.