100 lines
2.6 KiB
Batchfile
100 lines
2.6 KiB
Batchfile
@echo off
|
|
echo ========================================
|
|
echo SETUP GO-GIT ENVIRONMENT
|
|
echo ========================================
|
|
echo.
|
|
|
|
REM Set Gitea installation directory
|
|
set GITEA_DIR=C:\Program Files\gitea
|
|
set GIT_EXE=%GITEA_DIR%\git.exe
|
|
|
|
echo Step 1: Setting up environment variables...
|
|
set GITEA_CUSTOM_DIR=%GITEA_DIR%\custom
|
|
set GITEA_WORK_DIR=%GITEA_DIR%
|
|
set GITEA_TEMP=%TEMP%\gitea
|
|
|
|
echo GITEA_DIR=%GITEA_DIR%
|
|
echo GITEA_CUSTOM_DIR=%GITEA_CUSTOM_DIR%
|
|
echo GITEA_WORK_DIR=%GITEA_WORK_DIR%
|
|
echo GITEA_TEMP=%GITEA_TEMP%
|
|
|
|
echo.
|
|
echo Step 2: Creating necessary directories...
|
|
if not exist "%GITEA_CUSTOM_DIR%" mkdir "%GITEA_CUSTOM_DIR%"
|
|
if not exist "%GITEA_CUSTOM_DIR%\conf" mkdir "%GITEA_CUSTOM_DIR%\conf"
|
|
if not exist "%GITEA_TEMP%" mkdir "%GITEA_TEMP%"
|
|
|
|
echo.
|
|
echo Step 3: Creating minimal app.ini configuration...
|
|
(
|
|
echo [database]
|
|
echo DB_TYPE = sqlite3
|
|
echo PATH = %GITEA_DIR%\gitea.db
|
|
echo.
|
|
echo [repository]
|
|
echo ROOT = %GITEA_DIR%\repositories
|
|
echo.
|
|
echo [server]
|
|
echo DOMAIN = localhost
|
|
echo HTTP_PORT = 3000
|
|
echo ROOT_URL = http://localhost:3000/
|
|
echo.
|
|
echo [log]
|
|
echo MODE = console
|
|
echo LEVEL = Info
|
|
) > "%GITEA_CUSTOM_DIR%\conf\app.ini"
|
|
|
|
echo.
|
|
echo Step 4: Creating repositories directory...
|
|
if not exist "%GITEA_DIR%\repositories" mkdir "%GITEA_DIR%\repositories"
|
|
|
|
echo.
|
|
echo Step 5: Testing git.exe with environment...
|
|
echo Running: "%GIT_EXE%" --version
|
|
cd /d "%GITEA_DIR%"
|
|
"%GIT_EXE%" --version
|
|
|
|
if %errorlevel% equ 0 (
|
|
echo ✓ git.exe works with proper environment!
|
|
echo.
|
|
echo You can now use git.exe with:
|
|
echo set GITEA_WORK_DIR=%GITEA_DIR%
|
|
echo set GITEA_CUSTOM_DIR=%GITEA_DIR%\custom
|
|
echo cd /d "%GITEA_DIR%"
|
|
echo git.exe [command]
|
|
) else (
|
|
echo ❌ git.exe still fails
|
|
echo.
|
|
echo The git.exe that comes with Gitea may require:
|
|
echo 1. Gitea server to be running
|
|
echo 2. Specific command-line arguments
|
|
echo 3. Different working directory
|
|
echo.
|
|
echo Alternative: Use the Gitea API instead
|
|
echo python final_gitea_commit.py "Your commit message"
|
|
)
|
|
|
|
echo.
|
|
echo Step 6: Creating git wrapper script...
|
|
(
|
|
@echo off
|
|
setlocal
|
|
set GITEA_DIR=C:\Program Files\gitea
|
|
set GITEA_WORK_DIR=%GITEA_DIR%
|
|
set GITEA_CUSTOM_DIR=%GITEA_DIR%\custom
|
|
cd /d "%GITEA_DIR%"
|
|
"%GITEA_DIR%\git.exe" %*
|
|
) > gogit.bat
|
|
|
|
echo Created gogit.bat wrapper script
|
|
echo Use: gogit.bat [git commands]
|
|
echo Example: gogit.bat init
|
|
echo Example: gogit.bat add .
|
|
echo Example: gogit.bat commit -m "Message"
|
|
|
|
echo.
|
|
echo ========================================
|
|
echo SETUP COMPLETE
|
|
echo ========================================
|
|
echo Try using: gogit.bat --version
|
|
pause |