I put my creations here when I have nowhere to put them.

Git Personal Setup

2023-12-31 1 min

Covers creating SSH and GPG keys, and creating a minimal Git configuration for personal use.

 

Create SSH key:

ssh-keygen -t ed25519 -C ${EMAIL} -f ${HOME}/.ssh/git

When prompted, insert the passphrase.

 

Add the private key to the agent to avoid continuously typing the passphrase:

eval "$(ssh-agent -s)"
ssh-add ${HOME}/.ssh/git-scm

When prompted, insert the passphrase.

 

Create GPG key:

gpg --full-generate-key

Select the default kind (RSA and RSA), length (3072), and expiration (0).
Insert comment Git SCM.
Follow the prompts.

 

Get the GPG key ID:

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

 

Configure Git:

git config --global user.name "Valerio Del Bello"
git config --global user.email "git@valeriodelbello.net"
git config --global user.signingkey 19BBC53ACDC0DC9
git config --global commit.gpgsign true

 

Extract GPG keys for backup:

gpg --output git.public.pgp --armor --export git@valeriodelbello.net
gpg --output git.private.pgp --armor --export-secret-key git@valeriodelbello.net

 

If on git commit you get

error: gpg failed to sign the data
fatal: failed to write commit object

then set

export GPG_TTY=$(tty)