diff --git a/CONNECTION_SUCCESS.md b/CONNECTION_SUCCESS.md new file mode 100644 index 0000000..a23398a --- /dev/null +++ b/CONNECTION_SUCCESS.md @@ -0,0 +1,97 @@ +# ✅ 私有仓库连接成功 + +## 连接状态 + +- ✅ **Git 仓库连接**: 成功 +- ✅ **代码推送**: 成功 +- ✅ **分支跟踪**: 已设置 + +## 推送结果 + +``` +branch 'main' set up to track 'private/main'. +To https://git.quanyu360.cn/admin/wecom-ai-assistant.git + * [new branch] main -> main +``` + +代码已成功推送到私有仓库! + +## 仓库信息 + +- **仓库地址**: https://git.quanyu360.cn/admin/wecom-ai-assistant +- **远程名称**: `private` +- **分支**: `main` +- **跟踪关系**: `main` → `private/main` + +## 验证 + +访问以下 URL 确认代码已推送: + +**仓库主页**: https://git.quanyu360.cn/admin/wecom-ai-assistant + +应该能看到所有项目文件。 + +## 日常使用 + +### 推送代码到私有仓库 + +```powershell +# 推送到私有仓库(默认) +git push private main + +# 或简写(因为已设置跟踪) +git push +``` + +### 推送到 GitHub + +```powershell +git push origin main +``` + +### 推送到两个仓库 + +```powershell +git push private main +git push origin main +``` + +### 拉取最新代码 + +```powershell +# 从私有仓库拉取 +git pull private main + +# 或简写 +git pull +``` + +## 当前远程仓库配置 + +- **origin**: GitHub 仓库 +- **private**: 私有仓库(已设置为默认推送目标) + +## 下一步 + +现在可以: + +1. ✅ 继续开发,代码会自动推送到私有仓库 +2. ✅ 推送 Docker 镜像到私有 Registry +3. ✅ 配置生产环境使用私有镜像 + +## Docker 镜像推送 + +如果需要推送 Docker 镜像: + +```powershell +# 登录 Registry +docker login git.quanyu360.cn -u admin -p ye972030 + +# 构建并推送 Backend +docker build -f deploy/docker/backend.Dockerfile -t git.quanyu360.cn/wecom-ai/wecom-ai-backend:latest . +docker push git.quanyu360.cn/wecom-ai/wecom-ai-backend:latest + +# 构建并推送 Admin +docker build -f deploy/docker/admin.Dockerfile -t git.quanyu360.cn/wecom-ai/wecom-ai-admin:latest . +docker push git.quanyu360.cn/wecom-ai/wecom-ai-admin:latest +``` diff --git a/scripts/test-git-connection.ps1 b/scripts/test-git-connection.ps1 new file mode 100644 index 0000000..ac0e119 --- /dev/null +++ b/scripts/test-git-connection.ps1 @@ -0,0 +1,65 @@ +# 测试 Git 仓库连接 +# 用途:验证私有仓库连接是否正常 + +Write-Host "=== 测试 Git 仓库连接 ===" -ForegroundColor Cyan +Write-Host "" + +# 检查远程仓库配置 +Write-Host "1. 检查远程仓库配置..." -ForegroundColor Yellow +$remotes = git remote -v 2>&1 +if ($remotes -match "private") { + Write-Host "✓ 私有仓库已配置" -ForegroundColor Green + Write-Host $remotes -ForegroundColor Gray +} else { + Write-Host "✗ 私有仓库未配置" -ForegroundColor Red + exit 1 +} +Write-Host "" + +# 测试连接 +Write-Host "2. 测试仓库连接..." -ForegroundColor Yellow +$lsRemote = git ls-remote private 2>&1 +if ($LASTEXITCODE -eq 0) { + Write-Host "✓ 仓库连接成功" -ForegroundColor Green + if ($lsRemote) { + Write-Host " 远程分支:" -ForegroundColor Gray + $lsRemote | ForEach-Object { Write-Host " $_" -ForegroundColor Gray } + } else { + Write-Host " 仓库为空(可以推送)" -ForegroundColor Gray + } +} else { + Write-Host "✗ 仓库连接失败" -ForegroundColor Red + Write-Host " 错误信息:" -ForegroundColor Yellow + Write-Host $lsRemote -ForegroundColor Gray + exit 1 +} +Write-Host "" + +# 检查本地分支 +Write-Host "3. 检查本地分支..." -ForegroundColor Yellow +$currentBranch = git branch --show-current 2>&1 +if ($currentBranch) { + Write-Host "✓ 当前分支: $currentBranch" -ForegroundColor Green +} else { + Write-Host "⚠ 无法确定当前分支" -ForegroundColor Yellow +} +Write-Host "" + +# 检查是否有未推送的提交 +Write-Host "4. 检查未推送的提交..." -ForegroundColor Yellow +$unpushed = git log private/main..HEAD --oneline 2>&1 +if ($unpushed) { + Write-Host " 发现未推送的提交:" -ForegroundColor Cyan + $unpushed | ForEach-Object { Write-Host " $_" -ForegroundColor Gray } + Write-Host "" + Write-Host " 可以运行以下命令推送:" -ForegroundColor Yellow + Write-Host " git push -u private main" -ForegroundColor Gray +} else { + Write-Host "✓ 所有提交已推送" -ForegroundColor Green +} +Write-Host "" + +Write-Host "=== 测试完成 ===" -ForegroundColor Green +Write-Host "" +Write-Host "连接状态: ✓ 正常" -ForegroundColor Green +Write-Host ""