To set up a GPG key for use with KDE Wallet in Visual Studio Code, follow these steps:
1. Install GPG
Ensure gpg
is installed on your system:
sudo apt install gnupg # Debian/Ubuntu
sudo pacman -S gnupg # Arch
sudo dnf install gnupg # Fedora
2. Generate a GPG Key
Run the following command and follow the prompts:
gpg --full-generate-key
- Key Type: Choose
RSA (default)
. - Key Size:
3072
or4096
bits. - Expiration: Set as desired (e.g.,
0
for no expiration). - Name/Email: Use details tied to your KDE account.
3. List Your GPG Key
Note the Key ID (e.g., ABC123DEF456
):
gpg --list-secret-keys --keyid-format LONG
Output:
sec rsa3072/ABC123DEF456 2023-01-01 [SC]
A1B2C3D4E5F6G7H8I9J0K1L2M3N4O5P6Q7R8S9
4. Configure KDE Wallet to Use GPG
- Open KDE System Settings.
- Go to KDE Wallet > Wallet Preferences.
- Click Change Wallet Encryption.
- Select GPG and choose the key you generated.
- Confirm and close the settings.
5. Set Up VS Code/Git Integration
Configure Git to use KDE Wallet as the credential helper:
git config --global credential.helper /usr/lib/git-core/git-credential-libsecret
- If the path differs, adjust it (e.g.,
/usr/bin/git-credential-libsecret
).
6. Verify Functionality
- Open VS Code and perform an action requiring credentials (e.g., Git push).
- KDE Wallet should prompt you to store the password, encrypted with your GPG key.
Troubleshooting
- Passphrase Prompts: Ensure
gpg-agent
is running to cache your GPG passphrase. - Default Wallet: Set your KDE Wallet as the default in Wallet Preferences.
This setup ensures credentials used in VS Code are stored securely in KDE Wallet via GPG encryption.