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
Remote OS Version: 4.9.125-linuxkit [python:3.6 base image]
Remote Extension/Connection Type: Docker
Steps to Reproduce:
Configure git to gpg sign commits [global .gitconfig locally]
[commit]
gpgsign = true
Start project in dev container, try to commit
root@953bed01abcd:/workspaces/my-project# git commit -m dockerize
error: gpg failed to sign the data
fatal: failed to write commit object
Does this issue occur when you try this locally?: No
Does this issue occur when you try this locally and all extensions are disabled?: No
Reacted by Scott Miller, Robbie K, Derrick Liu, Tanja, Franck Nijhof, AJ Klein, Daniel Brown, Marcin Zielinski, Isabella Skořepová, Pascal Bourque and 6 more
Reacted by Tanja, Franck Nijhof, Pascal Bourque and Zeno Jiricek
I've managed to get this to work by using -v to map my local gpg agent socket into the container, likewise with the ssh agent:
"-v", "${env:HOME}/.gnupg/pubring.kbx:/root/.gnupg/pubring.kbx",
"-v", "${env:HOME}/.gnupg/trustdb.gpg:/root/.gnupg/trustdb.gpg",
// You'll probably have to change this to point to your gpg-agent socket.// Not sure where Mac/Windows put it."-v", "${env:XDG_RUNTIME_DIR}/gnupg/S.gpg-agent:/root/.gnupg/S.gpg-agent",
"-v", "${env:SSH_AUTH_SOCK}:${env:SSH_AUTH_SOCK}",
"-e", "SSH_AUTH_SOCK=${env:SSH_AUTH_SOCK}"
Not ideal, but it's a decent workaround and allows for signing commits in the container and fetching dependencies in private git repositories via ssh.
I have similar or same problem. I am using git on code-insiders bash with WSL as remote. What is strange is that sometimes it is working, and it stops working, or it is not working and then after some minutes it works.
I noticed that restarting code-insiders seems to make it work, but not always. I have no idea how to solve, I have tried the normal solutions for the messages "error: gpg failed to sign the data
fatal: failed to write commit object" that I found on the web. Nothing seems to work permanently.
Same issue if using Ubuntu WSL. I found a workaround using this repository but there is not a published, peer-reviewed package since the issue is fairly new.
I'm not quite sure if this is the right place to ask this, but what's the best way to use your GPG key from your computer on your Raspberry Pi to sign commits. Do you transfer the key? Do you create a new one?
I've managed to get this to work by using -v to map my local gpg agent socket into the container, likewise with the ssh agent:
"-v", "${env:HOME}/.gnupg/pubring.kbx:/root/.gnupg/pubring.kbx",
"-v", "${env:HOME}/.gnupg/trustdb.gpg:/root/.gnupg/trustdb.gpg",
// You'll probably have to change this to point to your gpg-agent socket.// Not sure where Mac/Windows put it."-v", "${env:XDG_RUNTIME_DIR}/gnupg/S.gpg-agent:/root/.gnupg/S.gpg-agent",
"-v", "${env:SSH_AUTH_SOCK}:${env:SSH_AUTH_SOCK}",
"-e", "SSH_AUTH_SOCK=${env:SSH_AUTH_SOCK}"
Not ideal, but it's a decent workaround and allows for signing commits in the container and fetching dependencies in private git repositories via ssh.
But I don't why nohup & won't working properly in .bashrc,while I press multitime ctrl+c or simply exit the terminal .the socat background process will exit too. But if I run it manually it won't behavior like this. I need to find a better way to let a socat run in background while container startup.
Got it implemented by copying pubring.kbx and trustdb.gpg into the container and then forwarding the agent socket in the container to the extra ('remote') socket on the local machine. This will need some testing in the wild to confirm it works as expected.
Christof Marti (@chrmarti) Do you mind sharing a code sample? Also, rather than copying the keyring (which is a manual operation), could we mount the GPG folder in the container instead?
Got it implemented by copying pubring.kbx and trustdb.gpg into the container and then forwarding the agent socket in the container to the extra ('remote') socket on the local machine. This will need some testing in the wild to confirm it works as expected.
Prove it.
show us a gif of it working on windows using docker-desktop for windows and vscode-remote connecting to a linux container.
Alessandro (Ale) Segala (@ItalyPaleAle) You can still mount the GPG folder (or the individual files) if you prefer. The implementation checks if the files exist before writing them.
Zeno Jiricek (@airtonix) This will be in the next version of the Remote-Containers extension. I have closed this issue for my own book-keeping.
Christof Marti (@chrmarti) Apologies, but I'm a bit confused... Did you fix this already? Does it work on the current version, or do we need to wait for the next version? Will there be some docs explaining how to do this?
It really tricky to setup to forward agent connection especially between windows and container myself,I almost forget how I done this before...Even though it can work but it still not that convenience ,and I give up to use container develop at the end years ago.
But I'm still excited to know that this feature is going to become build-in feature :D
This is available in the latest version of Remote-Containers (0.118.0). You will need VS Code Insiders to get that version at the moment. Make sure to have gpg installed locally and in the container (update the Dockerfile if needed).
Let me know if it works and open bug reports if it does not! 👍
Was super excited to try this out today Christof Marti (@chrmarti)! Currently seeing an issue with older versions of gpg2. Opened an issue here: #3048. In the meantime I'm working on getting my dev container setup with the latest gpg2.
Activity
jrobsonchase commentedon May 4, 2019
I've managed to get this to work by using
-vto map my local gpg agent socket into the container, likewise with the ssh agent:Not ideal, but it's a decent workaround and allows for signing commits in the container and fetching dependencies in private git repositories via ssh.
smiller171 commentedon Jun 5, 2019
Josh Robson Chase (@jrobsonchase) unfortunately there are numerous problems with this if you're running on a Mac or Windows host.
I think it makes sense to allow git operations to run locally when using remote containers to avoid this issue, possibly hidden behind a flag.
heberleh commentedon Jun 8, 2019
I have similar or same problem. I am using git on code-insiders bash with WSL as remote. What is strange is that sometimes it is working, and it stops working, or it is not working and then after some minutes it works.
I noticed that restarting code-insiders seems to make it work, but not always. I have no idea how to solve, I have tried the normal solutions for the messages "error: gpg failed to sign the data
fatal: failed to write commit object" that I found on the web. Nothing seems to work permanently.
silenceisgolden commentedon Jun 14, 2019
Same issue if using Ubuntu WSL. I found a workaround using this repository but there is not a published, peer-reviewed package since the issue is fairly new.
https://github.com/diablodale/pinentry-wsl-ps1
jletey commentedon Jul 22, 2019
I'm not quite sure if this is the right place to ask this, but what's the best way to use your GPG key from your computer on your Raspberry Pi to sign commits. Do you transfer the key? Do you create a new one?
LaysDragon commentedon Sep 13, 2019
For windows host, according to https://zhuanlan.zhihu.com/p/31802760 (Chinese)
Gpg4win implement a tcp socket to simulation the behavior of Unix Socket.
We can use socat to forward the tcp connection to unix socket.
Based on this tutorial, I tried to make scripts and config for Dev Container Version and it working.
{ "name":"...", "dockerFile":"...", "appPort": ["..."], "runArgs": [ "-v", "${env:APPDATA}/gnupg/pubring.kbx:/home/vscode/.gnupg/pubring.kbx", "-v", "${env:APPDATA}/gnupg/trustdb.gpg:/home/vscode/.gnupg/trustdb.gpg", "-v", "${env:APPDATA}/gnupg/S.gpg-agent.extra:/home/vscode/.gnupg-localhost/S.gpg-agent.extra:ro" ] }Then add script into .bashrc to launch the forwarding socat in background.
For me I launch a script in postCreateCommand to insert it automatic.
But I don't why nohup & won't working properly in .bashrc,while I press multitime ctrl+c or simply exit the terminal .the socat background process will exit too. But if I run it manually it won't behavior like this. I need to find a better way to let a socat run in background while container startup.
vovimayhem commentedon Apr 23, 2020
I'm really interested on any updates on this.
Does anyone has been successful in signing Git commits within the dev container?
chrmarti commentedon May 18, 2020
Got it implemented by copying pubring.kbx and trustdb.gpg into the container and then forwarding the agent socket in the container to the extra ('remote') socket on the local machine. This will need some testing in the wild to confirm it works as expected.
ItalyPaleAle commentedon May 18, 2020
Christof Marti (@chrmarti) Do you mind sharing a code sample? Also, rather than copying the keyring (which is a manual operation), could we mount the GPG folder in the container instead?
airtonix commentedon May 19, 2020
Prove it.
show us a gif of it working on windows using docker-desktop for windows and vscode-remote connecting to a linux container.
until then this isn't solved.
chrmarti commentedon May 19, 2020
Alessandro (Ale) Segala (@ItalyPaleAle) You can still mount the GPG folder (or the individual files) if you prefer. The implementation checks if the files exist before writing them.
Zeno Jiricek (@airtonix) This will be in the next version of the Remote-Containers extension. I have closed this issue for my own book-keeping.
ItalyPaleAle commentedon May 19, 2020
Christof Marti (@chrmarti) Apologies, but I'm a bit confused... Did you fix this already? Does it work on the current version, or do we need to wait for the next version? Will there be some docs explaining how to do this?
chrmarti commentedon May 19, 2020
Alessandro (Ale) Segala (@ItalyPaleAle) It will be available with the next version. It should work out-of-the-box and we will add documentation as needed.
LaysDragon commentedon May 20, 2020
It really tricky to setup to forward agent connection especially between windows and container myself,I almost forget how I done this before...Even though it can work but it still not that convenience ,and I give up to use container develop at the end years ago.
But I'm still excited to know that this feature is going to become build-in feature :D
chrmarti commentedon May 26, 2020
This is available in the latest version of Remote-Containers (0.118.0). You will need VS Code Insiders to get that version at the moment. Make sure to have
gpginstalled locally and in the container (update the Dockerfile if needed).Let me know if it works and open bug reports if it does not! 👍
[-]Unable to GPG Sign Commit when running in Dev Container[/-][+]GPG Sign Commit when running in Dev Container[/+][-]GPG Sign Commit when running in Dev Container[/-][+]GPG Sign Commit when running in DevContainer[/+]jtokoph commentedon May 26, 2020
Was super excited to try this out today Christof Marti (@chrmarti)! Currently seeing an issue with older versions of gpg2. Opened an issue here: #3048. In the meantime I'm working on getting my dev container setup with the latest gpg2.
airtonix commentedon May 28, 2020
It doesn't. Documentation required.
Christof Marti (@chrmarti) I think you've implmented something that assumes we want this feature turned on all the time...
so now this explodes our local docker environments.
chrmarti commentedon Jun 2, 2020
Zeno Jiricek (@airtonix) Let's try to make it work first. Could you open a new issue with details on what is not working?