六、踩过的坑总结
| 坑 | 现象 | 解决 |
| Git remote 是内部 Git | 无法控制 | 换成自己的 GitHub |
| 首次 push 要认证 | 密码被拒 | 用 Personal Access Token |
| Author identity unknown | Git 没配置 | git config –global user.name/email |
| ufw 防火墙阻挡 | 本地 200,外部打不开 | ufw allow 3004/tcp |
| Nginx 服务名不具体 | 显示为 nginx | 加 config/services.json |
| Web 服务混入 K8s 端口 | 31 个(含系统) | 加 type 字段区分 |
七、关键命令速查
# Mac(Git)
git remote set-url origin https://github.com/USER/REPO.git
git add . && git commit -m "update" && git push
# VPS(部署)
git clone https://github.com/USER/REPO.git
cp -r dist/* /var/www/SITE/
nginx -t && systemctl reload nginx
ufw allow PORT/tcp
# VPS(更新)
cd /root/REPO
git pull
cp -r dist/* /var/www/SITE/
bash /root/update-xxx.sh