Mac → GitHub → VPS → Nginx → 公网访问:一次完整的静态站点部署记录

第 1 步:Mac 上准备 Git 仓库

项目原本关联着一个内部 Git 仓库(git.chatgpt-team.site),我需要换成自己的 GitHub。

1.1 创建 GitHub 仓库

  • 打开 https://github.com/new
  • 仓库名:project-dashboard
  • 可见性:Private
  • 不要勾选任何初始化选项(README / gitignore / license)

1.2 改 Remote

cd ~/path/to/project-dashboard

# 查看当前 remote
git remote -v

# 改成自己的 GitHub
git remote set-url origin https://github.com/YOURNAME/project-dashboard.git

# 确认
git remote -v

1.3 更新 .gitignore

避免把无关文件推上去:

cat > .gitignore << 'EOF'
.DS_Store
.openai/
*.zip
*.command
EOF

1.4 提交 + Push

git add .
git commit -m "Prepare for GitHub deployment"
git push -u origin main

可能的坑:第一次 push 会要求认证。

  • 用户名:GitHub 用户名
  • 密码:不是 GitHub 登录密码,而是 Personal Access Token
  • 生成路径:https://github.com/settings/tokens → Generate new token (classic) → 勾选 repo

另一个坑:如果报 Author identity unknown,设置一下:

git config --global user.name "YOURNAME"
git config --global user.email "you@example.com"

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注