部署到 GitHub Pages 步骤
1. 在 GitHub 创建仓库
- 访问 https://github.com/new
- Repository name 填:
zhengjie9510.github.io - 选择 Public
- 不要勾选 “Add a README”
- 点击 Create repository
2. 推送代码
在终端执行:
cd ~/Documents/zhengjie9510.github.io
# 初始化 Git
git init
git add .
git commit -m "init: 公众号博客"
# 连接远程仓库并推送
git remote add origin https://github.com/zhengjie9510/zhengjie9510.github.io.git
git branch -M main
git push -u origin main
3. 启用 GitHub Pages
- 访问 https://github.com/zhengjie9510/zhengjie9510.github.io/settings/pages
- Source 选择 Deploy from a branch
- Branch 选择 main / /(root)
- 点击 Save
4. 等待部署
- 等待 1-2 分钟
- 访问 https://zhengjie9510.github.io 查看效果
5. 后续发布文章
cd ~/Documents/zhengjie9510.github.io
# 创建新文章
./scripts/new-post.sh "文章标题"
# 编辑文章...
# 提交发布
git add .
git commit -m "add: 新文章标题"
git push
访问地址: https://zhengjie9510.github.io