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

Dotfiles Sync

~15 min · dotfiles, rsync, git

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

Fleet 전반 일관 config

.zshrc, .gitconfig, ~/.ssh/config, 에디터 설정 — 모든 머신에 동일해야. 표준 접근 — dotfiles git repo + 작은 bootstrap 스크립트가 rsync 로 배포.

왜 rsync (symlink 아님)

어떤 dotfile 매니저는 repo 의 파일을 ~/ 로 symlink. 동작하지만 repo path 를 의존성 그래프로 끌어들임 — repo 위치 깨지면 셸 실패 시작. rsync 는 진짜 파일 배포; repo 가 버전 관리, 배포된 복사가 도는 거. 더 깨끗한 분리.

비밀 절대 commit X

Public key 는 dotfiles 에. Private key, API 키 든 env 파일, 토큰 — 절대 안 됨. .gitignoreid_*(.pub 빼고), .env*, 머신 안 떠나야 할 거 exclude.

Code

Repo 레이아웃·plaintext
~/dotfiles/
├── .zshrc
├── .gitconfig
├── .ssh/
│   └── config           # ← shared SSH config
├── .config/
│   ├── nvim/
│   └── starship.toml
├── Brewfile             # `brew bundle` source of truth
├── bootstrap.sh         # the deploy script
└── .gitignore           # exclude private keys, .env, etc.
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 into ~ — exclude the meta files
rsync -avh --no-perms "$DOTFILES/" "$HOME/" \
    --exclude '.git' \
    --exclude 'bootstrap.sh' \
    --exclude 'Brewfile' \
    --exclude 'README.md'

# Install Brew packages
brew bundle --file="$DOTFILES/Brewfile" || true

echo 'Done. Run: source ~/.zshrc'

External links

Exercise

없으면 최소 .zshrc.ssh/config~/dotfiles/ git repo 만들어. Repo 에서 ~/ 로 rsync 하는 10 줄 bootstrap.sh 작성. 두 번째 머신에서 시도 — 한 곳에서 GitHub push, 다른 곳에서 clone 하고 bootstrap, 셸 동일하게 올라오는 거 봐.

Progress

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

댓글 0

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

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