aleeusgr / nix-things

a toolbox
1 stars 0 forks source link

sign git commits #88

Closed aleeusgr closed 1 month ago

aleeusgr commented 1 month ago

I need to sign my commits: https://github.com/IntersectMBO/cardano-node/pull/5959

How to do this?

  1. install gnupg
  2. create a key
  3. tell git about the key
  4. set up commit signing
  5. git log --format=raw to see if the commits are signed.
aleeusgr commented 1 month ago

on nixOS these settings may be managed with home-manager

https://nix-community.github.io/home-manager/options.xhtml#opt-programs.git.signing

aleeusgr commented 1 month ago

https://discourse.nixos.org/t/nixos-home-manager-program-git-error-gpg-failed-to-sign-the-data/8533/5 https://discourse.nixos.org/t/how-to-full-git-setup-in-home-manager-or-else/24861

aleeusgr commented 1 month ago
  1. install gpg and attemt to generate the key: gpg --full-generate-key

gpg: agent_genkey failed: No pinentry

https://superuser.com/questions/1628782/gpg-signing-failed-no-pinentry

add pinentry:

nixos-rebuild

error: access to absolute path '/home/alex/.ssh/id_ed25519.pub' is forbidden in pure eval mode (use '--impure' to override)

remove the line, switch, reboot.

error repeats.

fixed: https://github.com/aleeusgr/nix-things/commit/bb38bdd85abe4f08026f14fcd25348ea6f4fb65a

doc:

https://jeppesen.io/git-commit-sign-nix-home-manager-ssh/

aleeusgr commented 1 month ago

https://discourse.nixos.org/t/cant-get-gnupg-to-work-no-pinentry/15373

https://github.com/NixOS/nixpkgs/issues/35464