Some checks failed
Build and Deploy / test-backend (push) Has been cancelled
Build and Deploy / build-backend (push) Has been cancelled
Build and Deploy / build-admin (push) Has been cancelled
Deploy to Production / build-backend (push) Has been cancelled
Deploy to Production / deploy (push) Has been cancelled
Co-authored-by: Cursor <cursoragent@cursor.com>
66 lines
2.2 KiB
PowerShell
66 lines
2.2 KiB
PowerShell
# 测试 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 ""
|