Publicamos actualizaciones para la documentación con frecuencia y es posible que aún se esté traduciendo esta página. Para obtener la información más reciente, visite la documentación en inglés.
To sign commits locally, you need to inform Git that there's a GPG or X.509 key you'd like to use.
Telling Git about your GPG key
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.
If you don't have a GPG key that matches your committer identity, you need to associate an email with an existing key. For more information, see "Associating an email with your GPG key".
If you have multiple GPG keys, you need to tell Git which one to use.
Abra TerminalTerminalGit Bash.
If you have previously configured Git to use a different key format when signing with --gpg-sign, unset this configuration so the default format of openpgp will be used.
$ git config --global --unset gpg.format
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.
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:
Para configurar tu llave de firma GPG principal en Git, pega el siguiente texto en sustitución de la ID de la llave GPG principal que quieras utilizar. En este ejemplo, el id. de clave de GPG es 3AA5C34371567BD2:
If you aren't using the GPG suite, run the following command in the zsh shell to add the GPG key to your .zshrc file, if it exists, or your .zprofile file:
$ if [ -r ~/.zshrc ]; then echo 'export GPG_TTY=$(tty)' >> ~/.zshrc; \
else echo 'export GPG_TTY=$(tty)' >> ~/.zprofile; fi
Alternatively, if you use the bash shell, run this command:
$ if [ -r ~/.bash_profile ]; then echo 'export GPG_TTY=$(tty)' >> ~/.bash_profile; \
else echo 'export GPG_TTY=$(tty)' >> ~/.profile; fi
Optionally, to prompt you to enter a PIN or passphrase when required, install pinentry-mac. For example, using Homebrew:
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.
If you don't have a GPG key that matches your committer identity, you need to associate an email with an existing key. For more information, see "Associating an email with your GPG key".
If you have multiple GPG keys, you need to tell Git which one to use.
Abra TerminalTerminalGit Bash.
If you have previously configured Git to use a different key format when signing with --gpg-sign, unset this configuration so the default format of openpgp will be used.
$ git config --global --unset gpg.format
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.
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:
Para configurar tu llave de firma GPG principal en Git, pega el siguiente texto en sustitución de la ID de la llave GPG principal que quieras utilizar. En este ejemplo, el id. de clave de GPG es 3AA5C34371567BD2:
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.
If you don't have a GPG key that matches your committer identity, you need to associate an email with an existing key. For more information, see "Associating an email with your GPG key".
If you have multiple GPG keys, you need to tell Git which one to use.
Abra TerminalTerminalGit Bash.
If you have previously configured Git to use a different key format when signing with --gpg-sign, unset this configuration so the default format of openpgp will be used.
$ git config --global --unset gpg.format
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.
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:
Para configurar tu llave de firma GPG principal en Git, pega el siguiente texto en sustitución de la ID de la llave GPG principal que quieras utilizar. En este ejemplo, el id. de clave de GPG es 3AA5C34371567BD2:
Configura Git para que use S/MIME para firmar confirmaciones y etiquetas. En Git� 2.19 o posterior, use los comandos git config gpg.x509.program y git config gpg.format:
Para utilizar S/MIME para firmar todos los repositorios:
En Git� 2.18 o anterior, use el comando git config gpg.program:
Para utilizar S/MIME para firmar todos los repositorios:
$ git config --global gpg.program smimesign
Para utilizar S/MIME para firmar un repositorio único:
$ cd /path/to/my/repository
$ git config --local gpg.program smimesign
Si estás utilizando una llave X.509 que coincide con tu identidad de persona que confirma el cambio, puedes comenzar firmando confirmaciones y etiquetas.
Si no usa una clave X.509 que coincida con la identidad del responsable de la confirmación, enumere las claves X.509 para las que tenga un certificado y una clave mediante el comando smimesign --list-keys.
$ smimesign --list-keys
De la lista de llaves X.509, copia el ID del certificado de la llave X.509 que desearías utilizar. En este ejemplo, el id. de certificado es 0ff455a2708394633e4bb2f88002e3cd80cbd76f: