git
Your git identity on every workstation, so you never run git config --global inside one.
Install git with the git devtool (or
packages: [git]), and this toolconfig writes your ~/.gitconfig so commits are
attributed to you from the first one:
devtools:
- name: git
toolconfigs:
- id: git
name: git
config:
userName: Ada Lovelace
userEmail: ada@example.comThat is all most people need. To set any other global git setting, see
settings.
Any other setting
settings takes any global git setting as a dotted key. A key is section.key, or
section.subsection.key when git’s syntax needs a subsection. Values may be strings,
numbers or booleans.
config:
userName: Ada Lovelace
userEmail: ada@example.com
settings:
init.defaultBranch: main
pull.rebase: true
core.editor: vim
diff.colorMoved: zebrarenders as:
[core]
editor = "vim"
[diff]
colorMoved = "zebra"
[init]
defaultBranch = "main"
[pull]
rebase = trueKeys are sorted so the output is stable; strings are quoted, booleans and numbers are
not. A key with no section, or a null value, is refused with a clear error.
config fields
| Field | Type | Description |
|---|---|---|
userName | string | user.name. |
userEmail | string | user.email. |
settings | object | Any other global git setting, as dotted key to value. |
Example
A personal layer that lands your identity on every workstation you own, including ones you create later, because it selects by label rather than by name:
apiVersion: workstations.ringleader.dev/v1
kind: WorkstationConfig
metadata:
name: my-git-identity
namespace: local
spec:
selector:
matchLabels:
owner: ada
priority: 200
devtools:
- name: git
toolconfigs:
- id: git
name: git
config:
userName: Ada Lovelace
userEmail: ada@example.com
settings:
init.defaultBranch: main
pull.rebase: trueNotes
- The file belongs to the login user, is readable by nobody else, and is rewritten every time the workstation applies its configuration, so edits inside the workstation revert.
- Values may carry
${secret:NAME}references, resolved inside the workstation. Do not put a credential in a git URL. - To clone and push private repositories, use HTTPS git with
credential injection, as Injected credentials
shows. It adds the credential outside the workstation. A
sources[].git.credentialRefhands its token or deploy key to the workstation for the clone it makes. An SSHKey lets every program in the workstation sign with your key while it is forwarded.