Git: Difference between revisions
m Rewrite sample config with nonexistent options |
m cleaner |
||
| (4 intermediate revisions by 3 users not shown) | |||
| Line 16: | Line 16: | ||
== Configuration == | == Configuration == | ||
Git can be configured using [[Home Manager]]: | Git can be configured using [[Home Manager]]: | ||
| Line 32: | Line 31: | ||
programs.git = { | programs.git = { | ||
enable = true; | enable = true; | ||
aliases = { | |||
ci = "commit"; | ci = "commit"; | ||
co = "checkout"; | co = "checkout"; | ||
| Line 56: | Line 55: | ||
programs.git = { | programs.git = { | ||
enable = true; | enable = true; | ||
package = pkgs.git.override { withLibsecret = true; }; | |||
extraConfig = { | |||
credential.helper = "libsecret"; | |||
}; | }; | ||
}; | }; | ||
| Line 80: | Line 78: | ||
programs.git = { | programs.git = { | ||
enable = true; | enable = true; | ||
extraConfig = { | |||
push = { autoSetupRemote = true; }; | push = { autoSetupRemote = true; }; | ||
}; | }; | ||
}; | |||
} | |||
</syntaxhighlight> | |||
=== Using your public SSH key as a signing key === | |||
You can naturally configure git to automatically sign your commits using your public SSH key like so:<syntaxhighlight lang="nix"> | |||
{ | |||
programs.git = { | |||
enable = true; | |||
signing = { | |||
key = "ssh-ed25519 AAAAAAAAAAAA...AA username@hostname"; | |||
signByDefault = true; | |||
}; | |||
extraConfig = { | |||
gpg = { | |||
format = "ssh"; | |||
}; | |||
}; | |||
}; | |||
} | |||
</syntaxhighlight>However, note that this will also require Home Manager to manage your SSH configuration:<syntaxhighlight lang="nix"> | |||
{ | |||
programs.ssh = { | |||
enable = true; | |||
addKeysToAgent = "yes"; | |||
}; | }; | ||
} | } | ||
| Line 182: | Line 205: | ||
[[Category:Applications]] | [[Category:Applications]] | ||
[[Category:CLI Applications]] | |||
[[Category:Version control]] | [[Category:Version control]] | ||