2.5 KiB
2.5 KiB
创建私有仓库并推送代码指南
步骤 1:在 Git 服务器上创建仓库
访问 Git 服务器
- 打开浏览器,访问:https://git.quanyu360.cn
- 使用以下凭据登录:
- 用户名:
admin - 密码:
ye972030
- 用户名:
创建新仓库
- 登录后,点击 "New Repository" 或 "新建仓库" 按钮
- 填写仓库信息:
- 仓库名称:
wecom-ai-assistant - 命名空间/组织:
admin(如果可以选择) - 可见性: 选择 Private(私有)
- 初始化选项:
- ❌ 不要勾选 "Initialize repository with a README"
- ❌ 不要勾选 "Add .gitignore"
- ❌ 不要勾选 "Choose a license"
- 仓库名称:
- 点击 "Create Repository" 或 "创建仓库"
步骤 2:推送代码到私有仓库
创建仓库后,运行以下命令推送代码:
# 确保远程仓库已配置
git remote remove private 2>$null
git remote add private https://admin:ye972030@git.quanyu360.cn/admin/wecom-ai-assistant.git
# 推送代码
git push -u private main
一键脚本
如果仓库已创建,可以直接运行:
.\scripts\push-to-private-repo.ps1
验证
推送成功后,访问以下 URL 验证:
仓库地址: https://git.quanyu360.cn/admin/wecom-ai-assistant
故障排查
问题:推送时提示 "repository not found"
原因: 仓库尚未创建
解决方案:
- 按照上面的步骤 1 手动创建仓库
- 然后重新推送
问题:推送时提示认证失败
解决方案:
# 更新远程 URL(包含凭据)
git remote set-url private https://admin:ye972030@git.quanyu360.cn/admin/wecom-ai-assistant.git
# 重新推送
git push -u private main
问题:仓库路径不正确
如果仓库路径不是 /admin/wecom-ai-assistant,请更新:
# 查看实际仓库 URL(在 Git 服务器上创建后可以看到)
# 然后更新远程 URL
git remote set-url private https://admin:ye972030@git.quanyu360.cn/实际路径/wecom-ai-assistant.git
完成后的配置
推送成功后,你的项目将有两个远程仓库:
- origin: GitHub 仓库(https://github.com/bujie9527/wecom-ai-assistant)
- private: 私有仓库(https://git.quanyu360.cn/admin/wecom-ai-assistant)
日常使用
# 推送到私有仓库(默认)
git push private main
# 推送到 GitHub
git push origin main
# 推送到两个仓库
git push private main
git push origin main