Skip to content

Instantly share code, notes, and snippets.

@andmax
Last active November 20, 2023 10:49
Show Gist options
  • Save andmax/c13d8279238833135760cd6745eb49d7 to your computer and use it in GitHub Desktop.
Save andmax/c13d8279238833135760cd6745eb49d7 to your computer and use it in GitHub Desktop.
git github ssh gpg
- To properly use github, it is important to add SSH and GPG keys
- to respectively connect (allowing git push/pull/clone) to github and
- sign commits (allowing git commit -S) adding a "verified" tag to it
- Using SSH key to connect sometimes requires to go thru port 443 instead of
- port 22 when accessing github:
- Edit ssh config to use port 443 https when accessing github via ssh
- and also to use ssh key (must be the same added in github):
$ emacs -nw ~/.ssh/config
Host github.com
User git
Hostname ssh.github.com
Port 443
PreferredAuthentications publickey
IdentityFile <full path to id_rsa private key>
- Replace to use https instead of git protocol:
$ git config --global url."https://".insteadOf git://
- Test github can be accessed:
$ ssh -T [email protected]
- Generate 1 gpg key:
$ gpg --full-generate-key
-- List secret keys
$ gpg --list-secret-keys --keyid-format=long
/home/andmax/.gnupg/pubring.kbx
-------------------------------
sec rsa4096/<private key> 2023-11-19 [SC] [expires: 2024-11-18]
<public key>
uid [ultimate] Andre Maximo <[email protected]>
ssb rsa4096/B895BCFB6B153C44 2023-11-19 [E] [expires: 2024-11-18]
-- Show public key block (to add it in github):
$ gpg --armor --export <key>
-- Set up gpg passphrase entry to use terminal via env. var.:
$ export GPG_TTY=$(tty)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment