feat: 娣诲姞澶氫釜鏂板姛鑳藉拰淇 - 鍖呮嫭鐢ㄦ埛绠$悊銆佹暟鎹簱杩佺Щ銆丟it鎺ㄩ€佸伐鍏风瓑

This commit is contained in:
赵杰 Jie Zhao (雄狮汽车科技)
2025-11-05 10:16:34 +08:00
parent a4261ef06f
commit c9d5c80f42
43 changed files with 4435 additions and 7439 deletions

108
simple_git_push.bat Normal file
View File

@@ -0,0 +1,108 @@
@echo off
chcp 65001 >nul
setlocal enabledelayedexpansion
echo ========================================
echo 简单Git推送工具
echo ========================================
echo.
:: 1. 显示Git状态
echo [1] Git状态:
git status --short
echo.
:: 2. 显示远程仓库
echo [2] 远程仓库:
git remote -v
if %errorlevel% neq 0 (
echo 错误: 未配置远程仓库
pause
exit /b 1
)
echo.
:: 3. 显示当前分支
echo [3] 当前分支:
for /f "tokens=*" %%b in ('git branch --show-current 2^>nul') do set branch=%%b
if "!branch!"=="" (
echo 警告: 无法获取分支名称尝试使用main
set branch=main
)
echo 分支: !branch!
echo.
:: 4. 检查是否有未提交的更改
echo [4] 检查未提交的更改...
git diff --quiet
set has_uncommitted=%errorlevel%
git diff --cached --quiet
set has_staged=%errorlevel%
if %has_uncommitted% neq 0 (
echo 有未暂存的更改
)
if %has_staged% neq 0 (
echo 有已暂存的更改
)
if %has_uncommitted% equ 0 if %has_staged% equ 0 (
echo 所有更改已提交
)
echo.
:: 5. 尝试推送
echo [5] 开始推送...
echo 命令: git push origin !branch!
echo.
git push origin !branch! 2>&1 | findstr /v "^$"
set push_error=!errorlevel!
if !push_error! equ 0 (
echo.
echo ========================================
echo 推送成功!
echo ========================================
) else (
echo.
echo ========================================
echo 推送失败!错误码: !push_error!
echo ========================================
echo.
echo 尝试设置上游并推送...
git push -u origin !branch! 2>&1 | findstr /v "^$"
set push_u_error=!errorlevel!
if !push_u_error! equ 0 (
echo.
echo ========================================
echo 推送成功(已设置上游)!
echo ========================================
) else (
echo.
echo ========================================
echo 推送仍然失败
echo ========================================
echo.
echo 常见问题和解决方案:
echo.
echo 1. 认证问题:
echo - 检查SSH密钥: ssh -T git@github.com (GitHub)
echo - 检查SSH密钥: ssh -T git@gitee.com (Gitee)
echo - 或使用HTTPS + Personal Access Token
echo.
echo 2. 远程仓库地址:
git config --get remote.origin.url
echo.
echo 3. 分支冲突:
echo - 先拉取: git pull origin !branch! --rebase
echo - 解决冲突后推送: git push origin !branch!
echo.
echo 4. 检查网络连接和远程仓库权限
echo.
)
)
echo.
pause