After configuring the GPG Key with Git Bash program from Windows, you can do this to sharing the same configuration to WSL2 and Visual Studio Dev Containers.
- In Windows, copy all the content from
~/.gnupgto clipboard. - In Windows, paste this content to
~/AppData/Roaming/gnupgfrom the clipboard. - In the distro from WSL2, paste this content to
\\wsl.localhost\{distribution}\home\{username}\.gnupgfrom the clipboard.
- In the distro from WSL2, copy from the file .bashrc to add this lines al the end of file
\\wsl.localhost\{distribution}\home\{username}\.bashrc. - Run this command from Linux Distribution in WSL2 and copy the GPG ID:
gpg --list-secret-keys --keyid-format LONG. - In the distro from WSL2, copy from the file gpg.conf to adding this to file path
\\wsl.localhost\{distribution}\home\{username}\.gnupg\gpg.conf. Then insert the GPG ID Key into the file. - In the distro from WSL2, copy from the file gpg-agent.conf to adding this to file path
\\wsl.localhost\{distribution}\home\{username}\.gnupg\gpg-agent.conf.
Thank you for documenting this @ChristianGrimberg 👏
It worked perfectly!