C.W.K.
Stream
Lesson 08 of 14 · published

Dotfiles 전략

~12 min · dotfiles, deploy, version-control

Level 0Pinger
0 XP0/101 lessons0/12 achievements
0/150 XP to next level150 XP to go0% complete

한 repo, 모든 머신 동일

Track 4 가 dotfiles + bootstrap.sh 도입. Fleet 관리가 dotfiles 가 진짜 보답하는 곳 — fleet 의 모든 머신이 같은 셸, 같은 git config, 같은 SSH config, 같은 에디터 셋업. 새 머신 onboarding 이 한 명령.

확장 구조

몇 년 동작하는 repo 레이아웃 — 위에 dotfiles (~/ 로 sync), 패키지 위한 Brewfile, 셋업 위한 bootstrap.sh, 옵션 fleet 전반 helper 위한 scripts/. .gitignore 가 private key, env 파일, 비밀 어떤 거든 제외.

Code

Repo 레이아웃·plaintext
~/dotfiles/
├── .zshrc
├── .gitconfig
├── .ssh/
│   └── config            # ← public — keys are per-machine
├── .config/
│   ├── nvim/
│   ├── starship.toml
│   └── ghostty/
├── Brewfile              # `brew bundle` source of truth
├── bootstrap.sh          # deploy script
├── scripts/              # fleet-wide helpers
│   ├── morning-check.sh
│   └── update-all.sh
├── README.md
└── .gitignore
bootstrap.sh — 머신마다 한 명령·bash
#!/bin/bash
set -euo pipefail

DOTFILES="$HOME/dotfiles"
REPO="git@github.com:you_username/dotfiles.git"

# Clone or update
if [[ -d "$DOTFILES" ]]; then
    git -C "$DOTFILES" pull --rebase
else
    git clone "$REPO" "$DOTFILES"
fi

# Sync files into ~ (excluding meta files)
rsync -avh --no-perms "$DOTFILES/" "$HOME/" \
    --exclude '.git' \
    --exclude 'bootstrap.sh' \
    --exclude 'Brewfile' \
    --exclude 'README.md' \
    --exclude 'scripts'

# Brew packages
if command -v brew >/dev/null; then
    brew bundle --file="$DOTFILES/Brewfile" || true
fi

# SSH socket directory for ControlMaster
mkdir -p ~/.ssh/sockets
chmod 700 ~/.ssh/sockets

echo 'Dotfiles deployed. Run: source ~/.zshrc'

External links

Exercise

Dotfiles repo 없으면 최소 .zshrc, .gitconfig, ~/.ssh/config 로 생성. 위 예의 bootstrap.sh 추가. GitHub push. 두 번째 맥에서 clone 하고 bootstrap. 두 머신이 이제 동일 config 공유 확인. 그게 fleet-baseline 상태.

Progress

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

댓글 0

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

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