Shared and host-local Git settings, identities and credentials.
~/.gitconfig→ symlink into the repo, identical on all hosts.git config --global alias.x ...lands there directly → commit, done.~/.gitconfig.local→ host-local, not in git, included after the shared settings.machine setupcreates it once from the context (work→ work user, otherwise private) and never overwrites it; on work hosts an existing file only gets a missinghttp.sslCAInfoappended. Signing key,safe.directory, credentials and proxy go here.- Owner rules at the end of
~/.gitconfigoverride the host default by remote URL: github.combosch-*/bosch_*/*_boschowners (HTTPS and SSH), GHES and Bitbucket →~/.config/git/work.gitconfig, any other github.com owner →~/.config/git/private.gitconfig. Each sets identity plus the GitHub credential username and helper. A repository name ending in_boschdoes not select the work identity. git-credential-env VARserves tokens from the environment or~/.env(GITHUB_TOKEN,BDC_GITHUB_TOKEN,GITHUB_PRIVATE_TOKEN) and never stores them. When a GUI-started process lacks the token, it sources only~/.shell/common/environment.shin Bash; it does not start interactive shell initialization. For github.com the variable follows the host type:GITHUB_TOKENon private hosts,GITHUB_PRIVATE_TOKENon work hosts (whereGITHUB_TOKENis the work token);machinewrites the choice to~/.config/git/github-token.gitconfigon every dotfile apply. On private hostsmachine setupalso switches the checkout'soriginto SSH (git@github.com:…) when the SSH key authenticates at GitHub, so pushing needs no token.~/.netrcentries for the same host take precedence in curl, so keep GitHub out of it.machine env pullwrites~/.netrcfrom Bitwarden (see secrets.md) and warns for agithub.comblock. When such a block is needed (for example by the work devcontainers),private.gitconfigsetshttp.https://github.com/.proactiveAuth = basic, so Git asks the credential helper first and the netrc entry is not used for pushes and fetches in a repository; this needs Git 2.46 or newer, and a firstgit cloneis not covered because no repository config exists yet.- Single repo with a different identity:
git user-work/git user-private(repo-local include of the same snippet), undo withgit user-unset-local; show:git user-show. machine updateandmachine commitmove host-only entries from the shared config into~/.gitconfig.local. A key that is absent locally moves, an equal value is dropped from the shared file, and a different local value is a conflict thatmachine updateasks about (non-interactive runs keep both and leave the shared file dirty). Repeated values are preserved. Backups live under~/.local/share/machine/local-overrides-backup/. Text added to~/.bashrcis handled the same way: known text is removed silently, new text is moved only when you select it, and moved text stands between# machine-local begin/endmarkers in~/.bashrc-local.- The installed pre-commit hook does the same before an ordinary Git commit. If it changes the shared file, review and stage the cleaned file, then commit again.
- CI runs
python3 -m machine_cli.local_overrides --checkand fails on committed host-only entries or invalid config. Hooks also run read-only whenCI=true. Restricted keys include user identity/signing keys, signing settings,safe.*,credential.*,http.*,https.*andcore.sshCommand;user.useConfigOnlyremains shared.