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.com

That 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
    url.git@github.com:.insteadOf: https://github.com/

renders as:

[core]
	editor = "vim"
[init]
	defaultBranch = "main"
[pull]
	rebase = true
[url "git@github.com:"]
	insteadOf = "https://github.com/"

Keys 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

FieldTypeDescription
userNamestringuser.name.
userEmailstringuser.email.
settingsobjectAny 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: true

Notes

  • 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 private repositories, use sources[].git.credentialRef or forward your key with an SSHKey.