@echo off chcp 65001 >nul echo ======================================== echo 知了数学题库系统 - Git 推送脚本 echo ======================================== echo. cd /d "%~dp0" echo [1/6] 检查 Git 是否安装... git --version >nul 2>&1 if errorlevel 1 ( echo 错误:未检测到 Git,请先安装 Git echo 下载地址:https://git-scm.com/download/win pause exit /b 1 ) echo Git 已安装 echo. echo [2/6] 初始化 Git 仓库(如果还没有)... if not exist .git ( git init echo Git 仓库已初始化 ) else ( echo Git 仓库已存在 ) echo. echo [3/6] 检查远程仓库... git remote get-url origin >nul 2>&1 if errorlevel 1 ( echo 添加远程仓库... git remote add origin https://git.yunzhixue.cn/wlh/wlh.git echo 远程仓库已添加 ) else ( echo 检查远程仓库地址... git remote set-url origin https://git.yunzhixue.cn/wlh/wlh.git echo 远程仓库地址已更新 ) echo. echo [4/6] 添加文件到暂存区... git add . echo 文件已添加 echo. echo [5/6] 提交更改... git commit -m "更新:知了数学题库系统" if errorlevel 1 ( echo 警告:提交失败,可能是没有更改或已提交 ) else ( echo 提交成功 ) echo. echo [6/6] 推送到远程仓库... git branch -M main git push -u origin main if errorlevel 1 ( echo. echo 推送失败,可能需要: echo 1. 检查网络连接 echo 2. 确认 Git 凭据配置 echo 3. 确认远程仓库权限 pause exit /b 1 ) else ( echo. echo ======================================== echo 推送成功! echo ======================================== ) echo. pause