# PowerShell script to push code to GitHub # Make sure Git is installed and available in PATH Write-Host "开始推送代码到 GitHub..." -ForegroundColor Green # 检查是否在 git 仓库中 if (-not (Test-Path ".git")) { Write-Host "初始化 Git 仓库..." -ForegroundColor Yellow git init } # 添加所有文件到暂存区 Write-Host "添加文件到暂存区..." -ForegroundColor Yellow git add . # 提交更改 Write-Host "提交更改..." -ForegroundColor Yellow git commit -m "feat: 添加轨迹页面颜色标签和预警配置appKey背景颜色功能 - 为轨迹状态、轨迹标记、轨迹内容页面的'是否'字段添加颜色标签 - 为预警配置页面的appKey添加根据启用状态的背景颜色 - 优化新增按钮与表格列表的对齐 - 改进删除按钮的图标显示和样式" # 检查远程仓库是否已添加 $remoteUrl = git remote get-url origin 2>$null if ($LASTEXITCODE -ne 0) { Write-Host "添加远程仓库..." -ForegroundColor Yellow git remote add origin https://github.com/xiaoliutral/itfx-front.git } # 推送到远程仓库 Write-Host "推送到远程仓库..." -ForegroundColor Yellow git push -u origin main if ($LASTEXITCODE -eq 0) { Write-Host "代码推送成功!" -ForegroundColor Green } else { Write-Host "推送失败,请检查网络连接和权限设置" -ForegroundColor Red Write-Host "您可能需要:" Write-Host "1. 检查 GitHub 仓库权限" Write-Host "2. 配置 Git 用户信息:" Write-Host " git config --global user.name 'Your Name'" Write-Host " git config --global user.email 'your.email@example.com'" Write-Host "3. 设置 GitHub 认证(推荐使用 Personal Access Token)" }