Skip to content

Instantly share code, notes, and snippets.

@ValchanOficial
Last active May 26, 2023 00:03
Show Gist options
  • Save ValchanOficial/4c7468d5ae436647394ece34578c4495 to your computer and use it in GitHub Desktop.
Save ValchanOficial/4c7468d5ae436647394ece34578c4495 to your computer and use it in GitHub Desktop.
[Github][GPG Key] generating a new gpg key
sudo apt install gnupg
gpg --full-generate-key
- RSA
- 4096 bits
- 0 // when it will expires
- name: <your name>
- email: <your email>
- comment:
passphrase: <create a password>
gpg --list-secret-key --keyid-form LONG // check if it was created
------------------------------------------------------------------------
sec rsa4096/<rsaID> 2023-01-01 [XX]
123ABC
uid [ultimate] <your name> <your email>
ssb rsa4096/123ABC 2023-01-01 [X]
------------------------------------------------------------------------
gpg --armor --export <rsaID>
Copy and add into github: https://github.com/settings/gpg/new
git config --global user.signingkey <rsaID>
Add GPG_TTY into .bashrc
vim ~/.bashrc or nano ~/.bashrc
export GPG_TTY=$(tty)
git commit -S -m "commit message" // one commit
git config commit.gpgSign true // one repository
git config --global commit.gpgSign true // all repositories
git config --global tag.gpgSign true // all tags
---------------------------------------
git log --show-signature -1 // check commit
---------------------------------------
Pass config:
vim ~/.gnupg/gpp.conf
use-agent
:wq
gpgconf --launch gpg-agent
---------------------------------------
Adding another email in the key
gpg --edit-key <rsaID>
adduid
name: <new name>
email: <new email>
comment:
O
uid 2
trust
(1-5) 5 - I trust ultimately
y
save
---------------------------------------
https://curso.fullcycle.com.br/curso-fullcycle/
https://www.gnupg.org/download/
https://docs.github.com/en/authentication/managing-commit-signature-verification/generating-a-new-gpg-key
https://git-scm.com/docs/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment