GPG Local Security
Local GPG Settings
Section titled “Local GPG Settings”Get keys from encrypted storage
or
Rebuild from scratch
cd ~/.ssh
# Create an OpenSSH key (used for cloning the Git Repo), create public and private key## Name key with date to identify generation datessh-keygen -t ed25519 -C "myemail@domain.com"
# Upload public key to repository like GitHub, format is like ssh-ed25519 long-key-string myemail@domain.comcat ~/.ssh/id_ed25519.pub
Other Key generation methods
Section titled “Other Key generation methods”# Generate new GPG keys for encryption# Generate a new key pair, for options:# - Kind of key: ECC and ECC (Elliptic curve cryptography)# - elliptic curve: Cure 25519 (ed25519)# - Key expiry date: 2 years# - User ID information: name, email, comment (do not enter comment)gpg --expert --full-gen-key
# Export your public key, give this file to people you want to communicate withgpg --armor --export user-id-or-email > pubkey.asc
# Import any you get from othersgpg --import <public key>
## Sign someone's public because you know it is from them and trust them locallygpg --sign-key <keyID>
Git Credential Management - SSH Option (command line friendly)
Section titled “Git Credential Management - SSH Option (command line friendly)”ssh-keygen -t ed25519 -C "myemail@domain.com"
- Copy public key to Github from
cat ~/.ssh/id_ed25519.pub
- Replace ~/.gitconfig with my gitconfig or:
git config --global user.name "My Name"git config --global user.email "myemail@domain.com"git config --global pull.rebase false
Windows
Section titled “Windows”# This single command will generate Git SSH keys and copy them into clipboard so can easily setup Git and GitHub on a new computer# source: Windows 11 dotfiles by https://github.com/nikitarevenco/dotfiles
New-Item -ItemType Directory -Path $env:USERPROFILE\.ssh -Force; ssh-keygen -t ed25519 -f"$env:USERPROFILE\.ssh\id_ed25519" -N '""' ; type "$env:USERPROFILE\.ssh\id_ed25519.pub" | clip