{"meta":{"title":"Associating an email with your GPG key","intro":"Your GPG key must be associated with a verified email that matches your committer identity.","product":"Authentication","breadcrumbs":[{"href":"/en/authentication","title":"Authentication"},{"href":"/en/authentication/managing-commit-signature-verification","title":"Verify commit signatures"},{"href":"/en/authentication/managing-commit-signature-verification/associating-an-email-with-your-gpg-key","title":"Associate email with GPG key"}],"documentType":"article"},"body":"# Associating an email with your GPG key\n\nYour GPG key must be associated with a verified email that matches your committer identity.\n\nIf you're using a GPG key that matches your committer identity and your verified email address associated with your account on GitHub.com, then you can begin signing commits and signing tags.\n\n1. Open <span class=\"platform-mac\">Terminal</span><span class=\"platform-linux\">Terminal</span><span class=\"platform-windows\">Git Bash</span>.\n\n2. Use the `gpg --list-secret-keys --keyid-format=long` command to list the long form of the GPG keys for which you have both a public and private key. A private key is required for signing commits or tags.\n\n   ```shell copy\n   gpg --list-secret-keys --keyid-format=long\n   ```\n\n   > \\[!NOTE]\n   > Some GPG installations on Linux may require you to use `gpg2 --list-keys --keyid-format LONG` to view a list of your existing keys instead. In this case you will also need to configure Git to use `gpg2` by running `git config --global gpg.program gpg2`.\n\n3. From the list of GPG keys, copy the long form of the GPG key ID you'd like to use. In this example, the GPG key ID is `3AA5C34371567BD2`:\n\n   ```shell copy\n   $ gpg --list-secret-keys --keyid-format=long\n   /Users/hubot/.gnupg/secring.gpg\n   ------------------------------------\n   sec   4096R/3AA5C34371567BD2 2016-03-10 [expires: 2017-03-10]\n   uid                          Hubot <hubot@example.com>\n   ssb   4096R/4BB6D45482678BE3 2016-03-10\n   ```\n\n4. Enter `gpg --edit-key GPG key ID`, substituting in the GPG key ID you'd like to use. In the following example, the GPG key ID is `3AA5C34371567BD2`:\n\n   ```shell\n   gpg --edit-key 3AA5C34371567BD2\n   ```\n\n5. Enter `gpg> adduid` to add the user ID details.\n\n   ```shell\n   gpg> adduid\n   ```\n\n6. Follow the prompts to supply your real name, email address, and any comments. You can modify your entries by choosing `N`, `C`, or `E`.\n   To keep your email address private, use your GitHub-provided `no-reply` email address.\n   For more information, see [Setting your commit email address](/en/account-and-profile/how-tos/email-preferences/setting-your-commit-email-address).\n\n   ```shell\n   Real Name: OCTOCAT\n   Email address: \"octocat@github.com\"\n   Comment: GITHUB-KEY\n   Change (N)ame, (C)omment, (E)mail or (O)kay/(Q)uit?\n   ```\n\n7. Enter `O` to confirm your selections.\n\n8. Enter your key's passphrase.\n\n9. Enter `gpg> save` to save the changes\n\n   ```shell\n   gpg> save\n   ```\n\n10. Enter `gpg --armor --export GPG key ID`, substituting in the GPG key ID you'd like to use. In the following example, the GPG key ID is `3AA5C34371567BD2`:\n\n    ```shell\n    $ gpg --armor --export 3AA5C34371567BD2\n    # Prints the GPG key, in ASCII armor format\n    ```\n\n11. Upload the GPG key by [adding it to your GitHub account](/en/authentication/managing-commit-signature-verification/adding-a-gpg-key-to-your-github-account).\n\n## Further reading\n\n* [Checking for existing GPG keys](/en/authentication/managing-commit-signature-verification/checking-for-existing-gpg-keys)\n* [Generating a new GPG key](/en/authentication/managing-commit-signature-verification/generating-a-new-gpg-key)\n* [Using a verified email address in your GPG key](/en/authentication/troubleshooting-commit-signature-verification/using-a-verified-email-address-in-your-gpg-key)\n* [Adding a GPG key to your GitHub account](/en/authentication/managing-commit-signature-verification/adding-a-gpg-key-to-your-github-account)\n* [Signing commits](/en/authentication/managing-commit-signature-verification/signing-commits)\n* [Signing tags](/en/authentication/managing-commit-signature-verification/signing-tags)"}