I want to setup my git config declaratively but I struggle to find how to do it.
I manage to find example how to sign my commits which is nice but I want to use github and that mean that I need to config ssh key and I don’t know how to do that
If the key is not password protected, you could have oneshot that adds the key to the agent, given it was started by another service before.
If it is password protected though stuff becomes more covoluted.
I am aware that there are users who have a pam.d based setup to unlock their keys, as well as emptying the agent when they lock their screen and filling back all keys in after unlocking again.
I do not remember whether it was @tejing or @viperML who talked about this recently…
I have a setup like that, but using gpg-agent/pam-gnupg rather than ssh-agent, so it’s probably not directly applicable. I’m not sure if the tools to do it with ssh-agent are readily available.
I looked here for reference what are the possible keys, their values and for what they are used but I spot key that you are using but it’s not present there
@tejing it seems that you use keyserver. I’m not sure what keyserver exactly do but I prefer my keys to be locally available. In that case I believe that I don’t need gpg-agent at all.
What I want is to have one primary key that have only cert capabilities and 3 subkeys with respectively sign, crypt and decrypt capabilities.
I believe that default-key should point to sign subkey
I still can’t find proper documentation that explain which option do what . Hopefully tomorrow I will find more info
The keyserver stuff just pertains to how to look up public keys you don’t have locally. I basically never use it.
You do need a gpg-agent to use gpg at all. gpg will not function without an agent since a while back, though it will start one on the fly if it doesn’t find one already running (which I turn off with no-autostart since it can muck up my systemd-started instance).
You can set the main key to have only cert capabilities if you want. However the other 3 roles are en/decrypt, sign, and authenticate. Encrypt and decrypt happen with the same subkey, though obviously one happens with the public key and one with the private. “Authenticate” is used if you set up ssh-agent emulation. It’s fundamentally also a kind of signing, but since the intended use has different security properties it gets its own category.
default-key always points to the main key, not subkeys. As a rule, you basically never refer to subkeys directly in gpg stuff. The subkey marked with the appropriate role will still be used.