17

I'd like to edit my user-level GPG configuration file (or the system-wide config, if that isn't possible), but I don't actually know where the relevant files are on Windows (or where I should create them, if they don't exist).

I'm using Windows 10. I used gpg4win to install it on my machine. My installation doesn't seem to include a gpg-option binary (when I run gpg-option from powershell, it says that the program could not be found). Where are my gpg configuration files?

1

2 Answers 2

19

Where are my gpg configuration files?

22.1 Personal user settings

The personal settings for each user are found in the file folder:

%APPDATA%\gnupg

Often, this is the following folder:

C:\Documents and settings\<name>\Application data\gnupg\

Please note that this is a hidden file folder. To make it visible, you have to activate the option Show all files and folders under the group Hidden files and folders in the tab View of the Explorer Extras -> Folder options menu

This file folder contains all personal GnuPG data, hence private keys, certificates, trust settings and configurations. This folder is not deleted when Gpg4win is uninstalled. Please ensure that you make regular backup copies of this folder.

Source Files and settings in Gpg4win


Further Reading

14

I know this has long since been answered and the OP has long since moved on from this problem, but there are a few "gotchas" in the accepted answer, so I'll add this one to clear up any confusion for people who find this answer later.

The first important thing is whether you installed GnuPG or you're using the one that gets installed with Git for Windows. I know the OP installed the separate one.

If you're using the one that you install separately from https://www.gnupg.org/ or https://gpg4win.org/, then the config folder is in %APPDATA%\gnupg.

On Windows XP (which you absolutely should not be using), the default is C:\Documents and Settings\%USERNAME%\Application Data\gnupg.

On any version of Windows that's likely to be in use today, the default is C:\Users\%USERNAME%\AppData\Roaming\gnupg.

The big gotcha, though, is that Git also installs its own version of GnuPG (gpg.exe), and uses it by default. The version that comes with Git uses %USERPROFILE%\.gnupg. On modern versions of Windows, this would be C:\Users\%USERNAME%\.gnupg.

SUMMARY


Use Your Installed GnuPG

If you want to use the GnuPG that you installed separately, you need to tell Git to also use that one. Here's how you do that:

git config --global gpg.program "c:/Program Files (x86)/GnuPG/bin/gpg.exe"

Also, make sure that directory is in your path before C:\Program Files\Git\usr\bin so that other software doesn't accidentally use the wrong one.

Use Git's GnuPG (gpg.exe)

If you want to use the GnuPG that's installed with Git, just uninstall the separate version you installed and refer to the info above for config path.

BONUS

The way you add the option you're trying to add is like this:

echo 'no-secmem-warning:0:1'|gpgconf --change-options gpg-agent

Then, you really don't need to care where the config is.

Note: Examples you might see online will often have a space between the pipe character (|) and other content. On PowerShell and BASH, this is fine. On cmd.exe, you have to remove those spaces like my example above or gpgconf.exe will complain and won't work, which are not desirable attributes in software or developers.

1
  • 3
    Brilliant! This was why VS Code couldn't find the gpg keys I created from the command line
    – Doug
    Commented Jan 26, 2022 at 20:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .