C.W.K.
Stream
Lesson 10 of 10 · published

Dotfile 관리

~12 min · dotfiles, chezmoi, stow, git

Level 0창 구경꾼
0 XP0/95 lessons0/14 achievements
0/100 XP to next level100 XP to go0% complete

왜 dotfile 을 버전 관리?

너의 ~/.zshrc, ~/.gitconfig, ~/.ssh/config, 그 외 십 수 개가 네 컴퓨터의 인격. 잃으면 새 Mac 이 며칠간 낯설어. git 에 담아두면 10 분 안에 자기를 복제.

plain git 접근

cd ~
git init --bare $HOME/.dotfiles.git
alias config='/usr/bin/git --git-dir=$HOME/.dotfiles.git --work-tree=$HOME'
config config status.showUntrackedFiles no
config add .zshrc .gitconfig .config/starship.toml
config commit -m 'starting'
config push -u origin main

홈을 working tree 로 다루되 명시적으로 추가한 파일만 추적. 새 Mac 에서 같은 alias + config checkout 으로 복원.

chezmoi — 전용 도구

brew install chezmoi. chezmoi init https://github.com/me/dotfiles. 파일은 별도 source 에 살고 chezmoi apply 가 홈에 적용. 템플릿, 비밀번호 매니저 연동, OS 조건부 내용. 가장 인기 있는 dotfile 매니저.

GNU Stow — symlink 농장

brew install stow. ~/dotfiles/zsh/ 등에 홈 구조 미러링, stow zsh~/.zshrc 에서 repo 로 symlink. 가볍고 템플릿 엔진 없음.

추적할 것 / 말 것

  • 추적: .zshrc, .gitconfig, .ssh/config (키는 빼고), .config/{starship,nvim,fish}, .vimrc, .tmux.conf, .editorconfig, .gitignore_global.
  • 제외: .env, .ssh/id_*, .ssh/known_hosts, .cache / .npm / .pyenv / .docker 안의 것. 상태와 비밀은 설정 아님.

Pippa 패턴

Pippa fleet 은 office-Mac-source-of-truth 모델. office 가 새 dotfile 변경 작성, peer 들은 sha256 검증하는 fleet-deploy 스크립트로 fan-out. 원리는 chezmoi 와 같음 — repo 하나, 머신 다수, idempotent 복원.

Code

빠른 chezmoi 셋업·bash
brew install chezmoi
# Add an existing dotfile
chezmoi add ~/.zshrc
# Edit the source
chezmoi edit ~/.zshrc
# Apply changes back to home
chezmoi apply
# Push the source repo to github
chezmoi cd

External links

Exercise

chezmoi 또는 plain-git 선택. 초기화. .zshrc, .gitconfig 추가. private GitHub repo 에 push. 두 번째 머신 (또는 새 사용자) 에서 같은 repo 로 복원. 시간 재기 — 10 분이 목표.

Progress

Progress is local-only — sign in to sync across devices.
이 페이지에서 버그를 발견하셨거나 피드백이 있으세요?문제 신고

댓글 0

🔔 답글 알림 (로그인 필요)
로그인댓글을 남기려면 로그인해 주세요.

아직 댓글이 없어요. 첫 댓글을 남겨보세요.