mirror of
https://github.com/d0zingcat/dotfiles.git
synced 2026-05-13 15:09:34 +00:00
docs: 更新备份相关文档说明
更新内容: - README.md: 更新 backup 命令说明,添加备份功能详细章节 - QUICKSTART.md: 添加离职前备份步骤 - CHECKLIST.md: 添加备份检查清单 - MIGRATION_GUIDE.md: 添加详细备份流程和离职前检查 - BACKUP_INSTRUCTIONS.md: 新建完整备份指南(离职前必读) 文档改进: - 明确标注哪些文件可以提交,哪些不能提交 - 添加备份报告解读说明 - 添加安全清单和离职检查项 - 添加常见问题解答
This commit is contained in:
195
BACKUP_INSTRUCTIONS.md
Normal file
195
BACKUP_INSTRUCTIONS.md
Normal file
@@ -0,0 +1,195 @@
|
|||||||
|
# Dotfiles 备份说明
|
||||||
|
|
||||||
|
> 详细备份指南 - 离职前必读
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 📋 目录
|
||||||
|
|
||||||
|
1. [备份目的](#备份目的)
|
||||||
|
2. [备份内容](#备份内容)
|
||||||
|
3. [备份步骤](#备份步骤)
|
||||||
|
4. [备份后处理](#备份后处理)
|
||||||
|
5. [常见问题](#常见问题)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 🎯 备份目的
|
||||||
|
|
||||||
|
离职前备份 dotfiles 的目的是:
|
||||||
|
|
||||||
|
- ✅ 保留开发环境配置
|
||||||
|
- ✅ 快速在新机器恢复工作环境
|
||||||
|
- ✅ 记录已安装的工具和扩展
|
||||||
|
- ✅ 保存 SSH 公钥(用于新机器授权)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 📦 备份内容
|
||||||
|
|
||||||
|
### 自动备份(运行 `./setup.sh backup`)
|
||||||
|
|
||||||
|
| 项目 | 说明 | 敏感性 | 提交 |
|
||||||
|
|------|------|--------|------|
|
||||||
|
| **Brewfile** | Homebrew 包列表 | 公开 | ✅ |
|
||||||
|
| **SSH 公钥** | `~/.ssh/*.pub` | 公开 | ⚠️ |
|
||||||
|
| **Git 配置** | 用户信息 | 敏感 | ❌ |
|
||||||
|
| **1Password** | SSH Agent 配置 | 敏感 | ⚠️ |
|
||||||
|
| **VSCode** | 扩展列表 | 公开 | ✅ |
|
||||||
|
|
||||||
|
### 需要手动备份
|
||||||
|
|
||||||
|
- [ ] 浏览器书签
|
||||||
|
- [ ] 1Password 紧急工具包
|
||||||
|
- [ ] 其他应用配置
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 🚀 备份步骤
|
||||||
|
|
||||||
|
### 步骤 1: 运行备份脚本
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd ~/.dotfiles
|
||||||
|
./setup.sh backup
|
||||||
|
```
|
||||||
|
|
||||||
|
### 步骤 2: 查看备份报告
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# 查看最新的备份报告
|
||||||
|
ls -lt .backup_report_*.md | head -1 | awk '{print $NF}' | xargs cat
|
||||||
|
```
|
||||||
|
|
||||||
|
备份报告会显示:
|
||||||
|
```
|
||||||
|
Backup Summary
|
||||||
|
==========================================
|
||||||
|
Items backed up: 5
|
||||||
|
Warnings: 0
|
||||||
|
|
||||||
|
Files to review:
|
||||||
|
✅ Safe to commit: Brewfile, .1password_config.txt, .vscode_extensions.txt
|
||||||
|
⚠️ DO NOT COMMIT: .git_config_summary.txt, ssh_backup_*/
|
||||||
|
```
|
||||||
|
|
||||||
|
### 步骤 3: 查看备份内容
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# 查看 Brewfile 变更
|
||||||
|
git diff Brewfile
|
||||||
|
|
||||||
|
# 查看 Git 配置摘要(敏感!看完删除)
|
||||||
|
cat .git_config_summary.txt
|
||||||
|
|
||||||
|
# 查看 SSH 公钥
|
||||||
|
ls ssh_backup_*/
|
||||||
|
cat ssh_backup_*/id_ed25519.pub
|
||||||
|
```
|
||||||
|
|
||||||
|
### 步骤 4: 提交安全文件
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# 只提交安全的文件
|
||||||
|
git add Brewfile
|
||||||
|
git commit -m 'backup: update dotfiles before leaving'
|
||||||
|
git push
|
||||||
|
```
|
||||||
|
|
||||||
|
### 步骤 5: 清理敏感文件
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# 确认敏感文件已被 .gitignore 排除
|
||||||
|
git status
|
||||||
|
|
||||||
|
# 手动清理(可选)
|
||||||
|
rm -f .git_config_summary.txt
|
||||||
|
rm -rf ssh_backup_*/
|
||||||
|
rm -f .1password_config.txt
|
||||||
|
rm -f .vscode_extensions.txt
|
||||||
|
rm -f .backup_report_*.md
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 📝 备份后处理
|
||||||
|
|
||||||
|
### 验证备份完整性
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# 1. 检查 Brewfile
|
||||||
|
head -20 Brewfile
|
||||||
|
|
||||||
|
# 2. 备份 SSH 公钥到安全位置
|
||||||
|
cp ssh_backup_*/id_ed25519.pub ~/Downloads/
|
||||||
|
|
||||||
|
# 3. 记录 Git 配置
|
||||||
|
git config --global user.name
|
||||||
|
git config --global user.email
|
||||||
|
```
|
||||||
|
|
||||||
|
### 保存备份报告
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# 将备份报告保存到安全位置(不提交到 git)
|
||||||
|
cp .backup_report_*.md ~/Downloads/dotfiles-backup-$(date +%Y%m%d).md
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## ❓ 常见问题
|
||||||
|
|
||||||
|
### Q1: 备份会包含我的 SSH 私钥吗?
|
||||||
|
|
||||||
|
**不会!** 备份只复制 `.pub` 公钥文件,私钥永远不会被复制或提交。
|
||||||
|
|
||||||
|
### Q2: 备份文件哪些可以提交到 Git?
|
||||||
|
|
||||||
|
| 文件 | 是否可提交 |
|
||||||
|
|------|-----------|
|
||||||
|
| Brewfile | ✅ |
|
||||||
|
| .git_config_summary.txt | ❌ 包含真实信息 |
|
||||||
|
| ssh_backup_*/ | ❌ 公钥也不提交 |
|
||||||
|
| .1password_config.txt | ⚠️ 仅配置说明 |
|
||||||
|
| .vscode_extensions.txt | ✅ |
|
||||||
|
|
||||||
|
### Q3: 如何确认敏感文件不会被提交?
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# 运行备份后检查
|
||||||
|
git status
|
||||||
|
|
||||||
|
# 如果敏感文件出现在 "Untracked files" 中,说明已被 .gitignore 正确排除
|
||||||
|
```
|
||||||
|
|
||||||
|
### Q4: 备份后多久需要重新备份?
|
||||||
|
|
||||||
|
- **定期备份**: 每月一次
|
||||||
|
- **安装新工具后**: 立即备份
|
||||||
|
- **离职前**: 必须备份
|
||||||
|
|
||||||
|
### Q5: 如何验证备份有效?
|
||||||
|
|
||||||
|
在新机器或虚拟机上测试:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git clone <your-repo> ~/.dotfiles-test
|
||||||
|
cd ~/.dotfiles-test
|
||||||
|
./setup.sh check
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 🔐 安全清单
|
||||||
|
|
||||||
|
离职前确认:
|
||||||
|
|
||||||
|
- [ ] 备份已推送到 GitHub
|
||||||
|
- [ ] 敏感文件已从本地删除
|
||||||
|
- [ ] 已移除旧机器的 GitHub 授权
|
||||||
|
- [ ] 已移除旧机器的 1Password 授权
|
||||||
|
- [ ] 已更新重要账户密码
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**祝你新工作顺利!** 🎉
|
||||||
56
CHECKLIST.md
56
CHECKLIST.md
@@ -224,3 +224,59 @@ k9s version
|
|||||||
- 查看 README.md 获取详细文档
|
- 查看 README.md 获取详细文档
|
||||||
- 查看 setup.sh --help 获取命令说明
|
- 查看 setup.sh --help 获取命令说明
|
||||||
- 查看 .sisyphus/plans/dotfiles-migration.md 获取计划详情
|
- 查看 .sisyphus/plans/dotfiles-migration.md 获取计划详情
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 💾 离职前备份
|
||||||
|
|
||||||
|
### 运行备份脚本
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd ~/.dotfiles
|
||||||
|
./setup.sh backup
|
||||||
|
```
|
||||||
|
|
||||||
|
### 备份验证
|
||||||
|
|
||||||
|
- [ ] **自动** Brewfile 已更新
|
||||||
|
- [ ] **自动** SSH 公钥已备份到 `ssh_backup_*/`
|
||||||
|
- [ ] **自动** Git 配置摘要已导出
|
||||||
|
- [ ] **自动** 1Password 配置已记录
|
||||||
|
- [ ] **自动** VSCode 扩展列表已导出
|
||||||
|
- [ ] **自动** 备份报告已生成
|
||||||
|
|
||||||
|
### 提交备份
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# 查看备份报告
|
||||||
|
cat .backup_report_*.md
|
||||||
|
|
||||||
|
# 提交安全文件
|
||||||
|
git status
|
||||||
|
git add Brewfile
|
||||||
|
git commit -m 'backup: pre-leaving dotfiles'
|
||||||
|
git push
|
||||||
|
```
|
||||||
|
|
||||||
|
### 清理敏感文件
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# 确认敏感文件已被 .gitignore 排除
|
||||||
|
git status
|
||||||
|
|
||||||
|
# 手动清理(可选)
|
||||||
|
rm -f .git_config_summary.txt
|
||||||
|
rm -rf ssh_backup_*/
|
||||||
|
rm -f .1password_config.txt
|
||||||
|
rm -f .vscode_extensions.txt
|
||||||
|
rm -f .backup_report_*.md
|
||||||
|
```
|
||||||
|
|
||||||
|
### 备份检查清单
|
||||||
|
|
||||||
|
- [ ] **手动** 确认 Brewfile 包含所有需要的包
|
||||||
|
- [ ] **手动** 记录 SSH 公钥(用于新机器)
|
||||||
|
- [ ] **手动** 备份 1Password 紧急工具包
|
||||||
|
- [ ] **手动** 导出浏览器书签
|
||||||
|
- [ ] **手动** 记录常用 Kubernetes 上下文
|
||||||
|
- [ ] **手动** 备份其他个人配置文件
|
||||||
|
|||||||
@@ -318,3 +318,92 @@ cask "app-name"
|
|||||||
---
|
---
|
||||||
|
|
||||||
**祝新工作顺利!** 🎉
|
**祝新工作顺利!** 🎉
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 💾 离职前备份流程
|
||||||
|
|
||||||
|
### 1. 运行备份脚本
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd ~/.dotfiles
|
||||||
|
./setup.sh backup
|
||||||
|
```
|
||||||
|
|
||||||
|
### 2. 备份输出说明
|
||||||
|
|
||||||
|
备份完成后会生成以下文件:
|
||||||
|
|
||||||
|
| 文件 | 内容 | 是否提交 |
|
||||||
|
|------|------|----------|
|
||||||
|
| `Brewfile` | Homebrew 包列表 | ✅ |
|
||||||
|
| `.git_config_summary.txt` | Git 配置(包含真实信息) | ⚠️ **不要** |
|
||||||
|
| `ssh_backup_YYYYMMDD_HHMMSS/` | SSH 公钥 | ⚠️ **不要** |
|
||||||
|
| `.1password_config.txt` | 1Password 设置 | ✅ |
|
||||||
|
| `.vscode_extensions.txt` | VSCode 扩展 | ✅ |
|
||||||
|
| `.backup_report_*.md` | 备份报告 | ✅ |
|
||||||
|
|
||||||
|
### 3. 查看备份报告
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# 查看最新的备份报告
|
||||||
|
cat .backup_report_*.md | tail -50
|
||||||
|
```
|
||||||
|
|
||||||
|
备份报告会显示:
|
||||||
|
- ✅ 已备份的项目
|
||||||
|
- ⚠️ 未找到的配置
|
||||||
|
- 📝 下一步操作建议
|
||||||
|
|
||||||
|
### 4. 提交备份
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# 查看变更
|
||||||
|
git status
|
||||||
|
|
||||||
|
# 提交安全文件
|
||||||
|
git add Brewfile .1password_config.txt .vscode_extensions.txt
|
||||||
|
git commit -m 'backup: pre-leaving dotfiles backup'
|
||||||
|
git push
|
||||||
|
```
|
||||||
|
|
||||||
|
### 5. 清理敏感文件
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# 确认敏感文件已被 .gitignore 排除
|
||||||
|
git status --porcelain | grep -E "(summary|ssh_backup)"
|
||||||
|
|
||||||
|
# 如果没有输出,说明已正确排除
|
||||||
|
```
|
||||||
|
|
||||||
|
### 6. 额外备份建议
|
||||||
|
|
||||||
|
- [ ] **导出浏览器书签** (Chrome/Fi refox/Safari)
|
||||||
|
- [ ] **备份 1Password 紧急工具包**
|
||||||
|
- [ ] **记录常用 SSH 主机配置**
|
||||||
|
- [ ] **导出 Kubeconfig** (如果允许)
|
||||||
|
- [ ] **备份其他应用配置** (Raycast, Obsidian 等)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 🔐 安全提醒
|
||||||
|
|
||||||
|
### 不要提交的文件
|
||||||
|
|
||||||
|
以下文件包含敏感信息,已在 `.gitignore` 中排除:
|
||||||
|
|
||||||
|
```
|
||||||
|
.git_config_summary.txt # Git 真实配置
|
||||||
|
ssh_backup_*/ # SSH 公钥
|
||||||
|
.1password_config.txt # 1Password 配置
|
||||||
|
.backup_report_*.md # 备份报告
|
||||||
|
```
|
||||||
|
|
||||||
|
### 离职前检查
|
||||||
|
|
||||||
|
- [ ] **移除旧机器授权**: GitHub → Settings → Devices
|
||||||
|
- [ ] **移除 1Password 授权**: 1Password → Settings → Security
|
||||||
|
- [ ] **更新重要账户密码**
|
||||||
|
- [ ] **备份个人 SSH 公钥** (用于新机器)
|
||||||
|
|
||||||
|
---
|
||||||
|
|||||||
@@ -89,3 +89,24 @@ brew bundle install
|
|||||||
# 备份当前配置
|
# 备份当前配置
|
||||||
./setup.sh backup
|
./setup.sh backup
|
||||||
```
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 💾 备份当前配置
|
||||||
|
|
||||||
|
离职前建议备份:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# 运行完整备份
|
||||||
|
./setup.sh backup
|
||||||
|
|
||||||
|
# 查看备份报告
|
||||||
|
cat .backup_report_*.md
|
||||||
|
|
||||||
|
# 提交变更
|
||||||
|
git add Brewfile
|
||||||
|
git commit -m 'backup: pre-leaving dotfiles'
|
||||||
|
git push
|
||||||
|
```
|
||||||
|
|
||||||
|
**注意**: 备份会生成敏感文件(`.git_config_summary.txt`, `ssh_backup_*/`),这些文件已在 `.gitignore` 中排除,**不要提交**。
|
||||||
|
|||||||
49
README.md
49
README.md
@@ -43,7 +43,7 @@ brew bundle install
|
|||||||
|------|------|
|
|------|------|
|
||||||
| `./setup.sh init` | 初始化新系统 (Homebrew, Xcode, antigen) |
|
| `./setup.sh init` | 初始化新系统 (Homebrew, Xcode, antigen) |
|
||||||
| `./setup.sh install` | 安装 dotfiles 软链接 |
|
| `./setup.sh install` | 安装 dotfiles 软链接 |
|
||||||
| `./setup.sh backup` | 备份当前配置到 Brewfile |
|
| `./setup.sh backup` | **完整备份** (Brewfile + Git 配置+SSH 公钥 +VSCode 扩展) |
|
||||||
| `./setup.sh sync` | 从 git 仓库同步最新配置 |
|
| `./setup.sh sync` | 从 git 仓库同步最新配置 |
|
||||||
| `./setup.sh full-recover` | 新机器完整恢复 (init + install + sync) |
|
| `./setup.sh full-recover` | 新机器完整恢复 (init + install + sync) |
|
||||||
| `./setup.sh check` | 检查当前安装状态 |
|
| `./setup.sh check` | 检查当前安装状态 |
|
||||||
@@ -300,3 +300,50 @@ MIT
|
|||||||
- [迁移检查清单](./CHECKLIST.md)
|
- [迁移检查清单](./CHECKLIST.md)
|
||||||
- [Neovim 配置](./nvim/README.md)
|
- [Neovim 配置](./nvim/README.md)
|
||||||
- [Dotfiles 迁移计划](./.sisyphus/plans/dotfiles-migration.md)
|
- [Dotfiles 迁移计划](./.sisyphus/plans/dotfiles-migration.md)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 💾 备份功能
|
||||||
|
|
||||||
|
`./setup.sh backup` 会备份以下配置:
|
||||||
|
|
||||||
|
### 备份内容
|
||||||
|
|
||||||
|
| 项目 | 说明 | 是否可提交 |
|
||||||
|
|------|------|-----------|
|
||||||
|
| **Brewfile** | Homebrew 包列表 | ✅ |
|
||||||
|
| **SSH 公钥** | `~/.ssh/*.pub` | ⚠️ 不提交 |
|
||||||
|
| **Git 配置摘要** | 用户信息(脱敏) | ⚠️ 不提交 |
|
||||||
|
| **1Password 配置** | SSH Agent 设置 | ✅ |
|
||||||
|
| **VSCode 扩展** | 已安装扩展列表 | ✅ |
|
||||||
|
| **备份报告** | 完整备份状态 | ✅ |
|
||||||
|
|
||||||
|
### 使用方式
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# 运行备份
|
||||||
|
./setup.sh backup
|
||||||
|
|
||||||
|
# 查看备份报告
|
||||||
|
cat .backup_report_*.md
|
||||||
|
|
||||||
|
# 提交安全文件
|
||||||
|
git add Brewfile .1password_config.txt .vscode_extensions.txt
|
||||||
|
git commit -m 'backup: update dotfiles'
|
||||||
|
```
|
||||||
|
|
||||||
|
### 安全提醒
|
||||||
|
|
||||||
|
- ⚠️ **不要提交**: `.git_config_summary.txt`, `ssh_backup_*/`
|
||||||
|
- ✅ **可以提交**: `Brewfile`, `.1password_config.txt`, `.vscode_extensions.txt`
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 📚 相关文档
|
||||||
|
|
||||||
|
| 文档 | 用途 |
|
||||||
|
|------|------|
|
||||||
|
| [BACKUP_INSTRUCTIONS.md](./BACKUP_INSTRUCTIONS.md) | **详细备份指南**(离职前必读) |
|
||||||
|
| [MIGRATION_GUIDE.md](./MIGRATION_GUIDE.md) | 个人备份说明 |
|
||||||
|
| [CHECKLIST.md](./CHECKLIST.md) | 配置检查清单 |
|
||||||
|
| [QUICKSTART.md](./QUICKSTART.md) | 快速开始指南 |
|
||||||
|
|||||||
Reference in New Issue
Block a user