#!/usr/bin/env sh # git/install.sh — configure git identity + HTTPS credential storage. # Idempotent: safe to re-run. set -eu say() { printf '%s\n' "$*" >&2; } GIT_NAME="Nic O'Connor" GIT_EMAIL="nic.oconnor@gmail.com" git config --global user.name "$GIT_NAME" git config --global user.email "$GIT_EMAIL" say "git identity: $GIT_NAME <$GIT_EMAIL>" # Auto-prune stale remote-tracking refs on every fetch/pull. # # Without this, `git branch -r` keeps listing branches that were deleted on the # server, and zsh's git completion happily offers them — so you tab-complete a # branch name into `git push origin --delete` and get "remote ref does not # exist" for something that was already gone. The prefix makes it worse: the # completion offers `origin/foo`, but the ref on the server is just `foo`, so # even a live branch fails unless you strip it by hand. See the `gbd` helper in # zsh/zshrc (the grmb helper) for that half. git config --global fetch.prune true say "fetch.prune = true (stale remote-tracking refs cleaned on every fetch)" # Plaintext credential cache in $HOME (survives container/VM rebuilds that # wipe everything outside $HOME). Git creates ~/.git-credentials with 0600 # the first time a credential is saved. git config --global credential.helper store say "credential.helper = store (~/.git-credentials, created on first auth)" say "Done. On the next HTTPS push/pull to a new host, git prompts once and caches the credential in ~/.git-credentials."