Git 与 GitHub
常用命令
bash
# 初始化并首次提交
git init
git add .
git commit -m "feat: 初始化项目"
# 关联远程仓库并推送
git remote add origin https://github.com/<user>/<repo>.git
git branch -M main
git push -u origin main
# 日常迭代
git status
git add -A
git commit -m "docs: 更新笔记"
git push提交信息规范
采用简化 Conventional Commits:
| 前缀 | 场景 |
|---|---|
feat: | 新功能 / 新内容 |
fix: | 修复 |
docs: | 文档变更 |
chore: | 构建 / 依赖 / 杂项 |
GitHub Actions 自动部署
知识库仓库根目录的 .github/workflows/deploy.yml 定义了 CI 流水线:main 分支 push 时自动构建 VitePress 并部署到 EdgeOne Pages。
依赖的仓库密钥:EDGEONE_API_TOKEN(Settings → Secrets and variables → Actions 中配置)。
常见坑
- 推送被拒(non-fast-forward):先
git pull --rebase再推; - 大文件进库:提交前确认
node_modules、dist已在.gitignore; - 换设备无凭据:用 GitHub Personal Access Token 代替密码推送。