Skip to main content

Associating an email with your GPG key

Your GPG key must be associated with a GitHub Enterprise Server verified email that matches your committer identity.

If you're using a GPG key that matches your committer identity and your verified email address associated with your account on your GitHub Enterprise Server instance, then you can begin signing commits and signing tags.

  1. Abra TerminalTerminalGit Bash.

  2. Use el comando gpg --list-secret-keys --keyid-format=long para enumerar el formato largo de las claves de GPG para las que tiene una clave pública y privada. Se requiere una llave privada para registrar confirmaciones o etiquetas.

    Shell
    $ gpg --list-secret-keys --keyid-format=long

    Nota: Es posible que en algunas instalaciones de GPG en Linux sea necesario usar gpg2 --list-keys --keyid-format LONG para ver una lista de las claves existentes en su lugar. En este caso, también tendrá que configurar Git para que use gpg2 mediante la ejecución de git config --global gpg.program gpg2.

  3. Desde la lista de llaves GPG, compia la forma larga de la ID de la llave GPG que quieres utilizar. En este ejemplo, el id. de clave de GPG es 3AA5C34371567BD2:

    Shell
    $ gpg --list-secret-keys --keyid-format=long
    /Users/hubot/.gnupg/secring.gpg
    ------------------------------------
    sec   4096R/3AA5C34371567BD2 2016-03-10 [expires: 2017-03-10]
    uid                          Hubot <hubot@example.com>
    ssb   4096R/42B317FD4BA89E7A 2016-03-10
  4. 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:

    $ gpg --edit-key 3AA5C34371567BD2
  5. Enter gpg> adduid to add the user ID details.

    $ gpg> adduid
  6. Follow the prompts to supply your real name, email address, and any comments. You can modify your entries by choosing N, C, or E.

    Real Name: OCTOCAT
    Email address: "octocat@github.com"
    Comment: GITHUB-KEY
    Change (N)ame, (C)omment, (E)mail or (O)kay/(Q)uit?
  7. Enter O to confirm your selections.

  8. Enter your key's passphrase.

  9. Enter gpg> save to save the changes

    $ gpg> save
  10. 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:

    $ gpg --armor --export 3AA5C34371567BD2
    # Prints the GPG key, in ASCII armor format
  11. Upload the GPG key by adding it to your GitHub account.

Further reading