67 lines
1.5 KiB
Batchfile
67 lines
1.5 KiB
Batchfile
@echo off
|
|
echo ========================================
|
|
echo COMMITTING WITH GO-GIT (GITEA)
|
|
echo ========================================
|
|
echo.
|
|
|
|
REM Set the path to Gitea's git.exe
|
|
set GIT_EXE="C:\Program Files\gitea\git.exe"
|
|
|
|
REM Check if git.exe exists
|
|
if not exist %GIT_EXE% (
|
|
echo ERROR: Git executable not found at %GIT_EXE%
|
|
echo Please ensure Gitea is installed at C:\Program Files\gitea
|
|
pause
|
|
exit /b 1
|
|
)
|
|
|
|
echo Using Go-Git: %GIT_EXE%
|
|
echo.
|
|
|
|
REM Get commit message from command line or use default
|
|
if "%1"=="" (
|
|
set "COMMIT_MSG=Auto-commit: %date% %time%"
|
|
) else (
|
|
set "COMMIT_MSG=%*"
|
|
)
|
|
|
|
echo Commit message: %COMMIT_MSG%
|
|
echo.
|
|
|
|
REM Initialize repository if .git doesn't exist
|
|
if not exist ".git" (
|
|
echo Initializing git repository...
|
|
%GIT_EXE% init
|
|
%GIT_EXE% config user.name "jleu3482"
|
|
%GIT_EXE% config user.email "jleu3482@mtrcompute.com"
|
|
%GIT_EXE% remote add origin https://git.mtrcompute.com/jleu3482/railseek6.git
|
|
echo Repository initialized.
|
|
echo.
|
|
)
|
|
|
|
REM Add all files
|
|
echo Adding files...
|
|
%GIT_EXE% add .
|
|
echo.
|
|
|
|
REM Commit
|
|
echo Committing changes...
|
|
%GIT_EXE% commit -m "%COMMIT_MSG%"
|
|
echo.
|
|
|
|
REM Push to remote
|
|
echo Pushing to remote repository...
|
|
%GIT_EXE% push -u origin main
|
|
if errorlevel 1 (
|
|
echo Trying master branch...
|
|
%GIT_EXE% push -u origin master
|
|
)
|
|
|
|
echo.
|
|
echo ========================================
|
|
echo COMMIT COMPLETE
|
|
echo ========================================
|
|
echo Repository: https://git.mtrcompute.com/jleu3482/railseek6
|
|
echo Commit: %COMMIT_MSG%
|
|
echo.
|
|
pause |