Skip to main content

This version of GitHub Enterprise Server was discontinued on 2024-12-19. No patch releases will be made, even for critical security issues. For better performance, improved security, and new features, upgrade to the latest version of GitHub Enterprise Server. For help with the upgrade, contact GitHub Enterprise support.

Generating a new GPG key

If you don't have an existing GPG key, you can generate a new GPG key to use for signing commits and tags.

Platform navigation

Supported GPG key algorithms

GitHub supports several GPG key algorithms. If you try to add a key generated with an unsupported algorithm, you may encounter an error.

  • RSA
  • ElGamal
  • DSA
  • ECDH
  • ECDSA
  • EdDSA

Generating a GPG key

Note

Before generating a new GPG key, make sure you've verified your email address. If you haven't verified your email address, you won't be able to sign commits and tags with GPG.

  1. Download and install the GPG command line tools for your operating system. We generally recommend installing the latest version for your operating system.

  2. Open TerminalTerminalGit Bash.

  3. Generate a GPG key pair. Since there are multiple versions of GPG, you may need to consult the relevant man page to find the appropriate key generation command.

    • If you are on version 2.1.17 or greater, paste the text below to generate a GPG key pair.

      Shell
      gpg --full-generate-key
      
    • If you are not on version 2.1.17 or greater, the gpg --full-generate-key command doesn't work. Paste the text below and skip to step 6.

      Shell
      gpg --default-new-key-algo rsa4096 --gen-key
      
  4. At the prompt, specify the kind of key you want, or press Enter to accept the default.

  5. At the prompt, specify the key size you want, or press Enter to accept the default.

  6. Enter the length of time the key should be valid. Press Enter to specify the default selection, indicating that the key doesn't expire. Unless you require an expiration date, we recommend accepting this default.

  7. Verify that your selections are correct.

  8. Enter your user ID information.

    Note