đ Bare-Git Dotfiles Across macOS and Linux
Dieser Inhalt ist noch nicht in deiner Sprache verfĂŒgbar.
One dotfiles repo shared across macOS and CachyOS using the bare-git approach â no symlinks, no extra tooling, files live in their real locations. OS differences are handled by conditional logic inside the shared files. Secrets never enter the repo (Level 1 below); 1Password integration is deferred.
These steps are meant to be executed manually (security + learning).
1. Initialize the bare repo (start on macOS)
Section titled â1. Initialize the bare repo (start on macOS)âgit init --bare $HOME/.dotfilesecho 'alias dotfiles="git --git-dir=$HOME/.dotfiles --work-tree=$HOME"' >> ~/.zshrcsource ~/.zshrcdotfiles config --local status.showUntrackedFiles noshowUntrackedFiles no hides the rest of $HOME from status â only files you
explicitly dotfiles add are tracked.
2. Add the first files
Section titled â2. Add the first filesâdotfiles add ~/.zshrc ~/.gitconfig ~/.config/ghostty/configdotfiles commit --message "Initial commit: zsh, git, ghostty"3. Add OS-conditional logic to ~/.zshrc
Section titled â3. Add OS-conditional logic to ~/.zshrcâcase "$OSTYPE" in darwin*) eval "$(/opt/homebrew/bin/brew shellenv)" ;; linux*) alias ls='ls --color=auto' ;;esacGrow this block as real differences appear â donât speculatively add cases.
4. Secrets, Level 1: uncommitted local includes
Section titled â4. Secrets, Level 1: uncommitted local includesâIn ~/.zshrc (committed):
[[ -f ~/.zshrc.local ]] && source ~/.zshrc.localIn ~/.gitconfig (committed):
[include] path = ~/.gitconfig.localAPI tokens, work email, signing keys, machine-specific paths go into the
.local files. Never dotfiles add them. They are not backed up â you
recreate them per machine.
5. Push to GitHub
Section titled â5. Push to GitHubâgh repo create dotfiles --privatedotfiles remote add origin git@github.com:gschlabitz/dotfiles.gitdotfiles branch --move --force maindotfiles push --set-upstream origin main6. Bootstrap on the second machine (CachyOS)
Section titled â6. Bootstrap on the second machine (CachyOS)âgit clone --bare git@github.com:gschlabitz/dotfiles.git $HOME/.dotfiles# add the same alias to ~/.zshrc there, then:dotfiles config --local status.showUntrackedFiles no# checkout fails if stock configs already exist â back them up, then retry:dotfiles checkout 2>&1 | grep --extended-regexp '^\s+' | xargs -I{} mv {} {}.bakdotfiles checkoutThen recreate ~/.zshrc.local and ~/.gitconfig.local manually on that
machine.
Later (explicitly out of scope for now)
Section titled âLater (explicitly out of scope for now)â- Secrets, Level 2: 1Password CLI in
.zshrc.local, e.g.export OPENAI_API_KEY="$(op read 'op://Private/OpenAI/credential')" - Package bootstrap:
Brewfile(macOS) + pacman/AUR pkglist (CachyOS) + aninstall.shthat detects OS - Windows: ignore, or a manually-copied
windows/folder (usage is rare) - Ghostty: config is already designed (TokyoNight light/dark following
system appearance, frosted glass, Hack Nerd Font Mono);
background-blur-radiusis silently ignored on Linux, so one shared config works. Hack Nerd Font must be installed per machine (brew install --cask font-hack-nerd-font/ AUR equivalent).
- Always use the
dotfilesalias â plaingitin$HOMEwonât find the repo (itâs not named.git), which is a built-in safety net. - A private GitHub repo is not a secrets store: treat anything committed as eventually-public.