You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For signing git commits, git uses GnuPG as an external program, defaulting to gpg. That binary is provided in the container, the problem with it is, it cannot use the gpg-agent as provided by Seahorse etc. and bails out on needing to supply a passphrase without a terminal.
The gpg program name can be overridden to gpg2 in git configuration, but this binary is not present in the container. Neither, I believe, the agent socket is forwarded from the desktop.
gpg is now an alias to gpg2 in the runtime.
There is still no way to forward gpg-agent socket from the host; the feature tracking issue is flatpak/flatpak#2301.
I've been working on this recently. I'm now able to sign commits inside the flatpak.
First you have to allow access to the gpg-agent using Flatseal or flatpak override.
Also make sure that the gpg-agent is active.
Then there is a problem with DBUS_SESSION_BUS_ADDRESS environment variable. We need to set it to unix:path=$XDG_RUNTIME_DIR/bus but it defaults to unix:path=/run/flatpak/bus.
Unfortunately you can't use Flatseal or flatpak override to override it. But you can use this custom pinentry program:
Don't forget to set pinentry-program in your gpg-agent.conf.
Eventally you can use flatpak run --no-session-bus com.visualstudio.code along with sharing xdg-run/bus manually with VSCode using Flatseal / flatpak override.
Ok, so for now, the only possible solution is to use the GNOME SDK which provides a pinentry program. You also need to allow talking to org.gnome.keyring.SystemPrompter. Even though, this will only work on GNOME.
Just simply run flatpak run --runtime=org.gnome.Sdk --runtime-version=44 --talk-name=org.gnome.keyring.SystemPrompter com.visualstudio.code and it should work.
Do not forget to remove any previous fix in my comment above.
One last solution is to build our own runtime. But it's really a last resort option as it may not be accepted as a fix. And it's also very boring to maintain.
In Flatseal enabling socket=gpg-agent and installing pinentry (sudo apt install pinentry-tty) fixed the issue for me. This should be added into the build by default.
If using pinentry-gnome3 on host, enabling socket=gpg-agent doesn't work. Adding talk-name=org.gnome.keyring.SystemPrompter doesn't help either. A workaround is to manually set pinentry program to pinentry-tty on host and set GPG_TTY env in flatpak (tty inside flatpak is often different from host on my pc, I don't know why).
Activity
mzabaluev commentedon May 19, 2019
gpgis now an alias togpg2in the runtime.There is still no way to forward gpg-agent socket from the host; the feature tracking issue is flatpak/flatpak#2301.
teohhanhui commentedon Jul 23, 2021
Looks like the current workaround would be to add
pinentryto the build, just like flathub/com.jetbrains.IntelliJ-IDEA-Community#63Otherwise
git commitwould be broken whencommit.gpgsign=true:Mikaela commentedon Apr 10, 2022
Does this also affect signing git commits with SSH?
alexojegu commentedon Aug 21, 2022
The issue flatpak/flatpak#2301 is closed now, and the PR flatpak/flatpak#4958 is merged.
How can I sign git commits?
mpi3d commentedon Jul 25, 2023
I've been working on this recently. I'm now able to sign commits inside the flatpak.
First you have to allow access to the gpg-agent using Flatseal or
flatpak override.Also make sure that the gpg-agent is active.
Then there is a problem with
DBUS_SESSION_BUS_ADDRESSenvironment variable. We need to set it tounix:path=$XDG_RUNTIME_DIR/busbut it defaults tounix:path=/run/flatpak/bus.Unfortunately you can't use Flatseal or
flatpak overrideto override it. But you can use this custompinentryprogram:Don't forget to set
pinentry-programin yourgpg-agent.conf.Eventally you can use
flatpak run --no-session-bus com.visualstudio.codealong with sharingxdg-run/busmanually with VSCode using Flatseal /flatpak override.Finally, here is the straight forward solution:
Tested on Fedora with GNOME. Not sure for other desktop environments like KDE or XFCE, but always happy to help if needed.
mpi3d commentedon Jul 27, 2023
Eventually, this will prevent using GPG to sign commits inside a devcontainer.
I'm working on a better fix.
mpi3d commentedon Jul 28, 2023
Ok, so for now, the only possible solution is to use the GNOME SDK which provides a
pinentryprogram. You also need to allow talking toorg.gnome.keyring.SystemPrompter. Even though, this will only work on GNOME.Just simply run
flatpak run --runtime=org.gnome.Sdk --runtime-version=44 --talk-name=org.gnome.keyring.SystemPrompter com.visualstudio.codeand it should work.Do not forget to remove any previous fix in my comment above.
In the meantime, I've created this issue: https://gitlab.com/freedesktop-sdk/freedesktop-sdk/-/issues/1621. If it's solved, I will be able to provide a much better fix.
One last solution is to build our own runtime. But it's really a last resort option as it may not be accepted as a fix. And it's also very boring to maintain.
feat: remove vscode flatpak in favour of native package, due to too m…
feat: remove vscode flatpak in favour of native package, due to too m…
VictorVow commentedon Apr 4, 2024
In Flatseal enabling
socket=gpg-agentand installing pinentry (sudo apt install pinentry-tty) fixed the issue for me. This should be added into the build by default.Tealk commentedon May 10, 2024
On Fedoara 40 Silverblue it was sufficient to activate
socket=gpg-agentchenxiex commentedon Feb 12, 2025
If using
pinentry-gnome3on host, enablingsocket=gpg-agentdoesn't work. Addingtalk-name=org.gnome.keyring.SystemPrompterdoesn't help either. A workaround is to manually set pinentry program topinentry-ttyon host and setGPG_TTYenv in flatpak (tty inside flatpak is often different from host on my pc, I don't know why).chenxiex commentedon Feb 13, 2025
Signing commit in devcontainer also fails even with
socket=gpg-agent.alexojegu commentedon Apr 5, 2025
Here is the discussion on the GnuPG lists about it:
https://lists.gnupg.org/pipermail/gnupg-users/2025-February/067509.html
@mpi3d maybe you can add this link to the issue you have opened to see if
freedesktop-sdkandGnuPGcan fix the problem.alexojegu commentedon Jul 13, 2025
Fixed with the latest
freedesktop-sdk, tested withfreedesktop-sdk-24.08.22. More information in GitLab issue and merge request.The only thing left to do is to enable the gpg-agent socket in VSCode #577.