Da Anonimo (non verificato) , 29 Aprile 2026

Cosa otterrai

Configurerai Git per firmare commit e tag usando la tua chiave SSH esistente.

Perche firma SSH

La firma SSH e atterrata in Git 2.34. Riusa la chiave SSH che gia usi per i push.

Passo 1: confermare versione Git

git --version

Passo 2: confermare che esiste una chiave SSH

ls -la ~/.ssh/id_ed25519*
ssh-keygen -t ed25519 -C "[email protected]"

Passo 3: configurare Git per firmare con SSH

git config --global gpg.format ssh
git config --global user.signingkey ~/.ssh/id_ed25519.pub
git config --global commit.gpgsign true
git config --global tag.gpgsign true

Passo 4: testare

cd /tmp/sign-test
git init
echo "test" > file.txt
git add . && git commit -m "Test signed commit"
git log --show-signature -1

Passo 5: configurare allowed signers

mkdir -p ~/.config/git
echo "[email protected] $(cat ~/.ssh/id_ed25519.pub)" \
  >> ~/.config/git/allowed_signers
git config --global gpg.ssh.allowedSignersFile ~/.config/git/allowed_signers

Passo 6: verificare un commit

git verify-commit HEAD
git log --show-signature
git verify-tag v1.0.0

Passo 7: caricare la chiave all'host Git

Per GitHub: Settings → SSH and GPG keys → New SSH key.

Passo 8: firmare commit precedenti

git commit --amend --no-edit -S
git rebase -i <base> --exec 'git commit --amend --no-edit -S'

Passo 9: imporre commit firmati

gh api -X PUT repos/owner/repo/branches/main/protection \
  -F required_signatures.enabled=true

Passo 10: gestire macchine multiple

  • Chiave per macchina, tutte caricate all'host.
  • Una chiave master copiata.
  • Chiave hardware (YubiKey).

Firma hardware-backed

ssh-keygen -t ed25519-sk -O resident -C "[email protected]"

Passo 11: firmare tag

git tag -s v1.0.0 -m "Release 1.0.0"
git tag -v v1.0.0