103 lines
2.7 KiB
Batchfile
103 lines
2.7 KiB
Batchfile
@echo off
|
|
setlocal
|
|
|
|
echo ================================================
|
|
echo AHAD QUANT - Publication automatique sur GitHub
|
|
echo ================================================
|
|
echo.
|
|
|
|
cd /d "%~dp0"
|
|
echo Dossier de travail : %cd%
|
|
echo.
|
|
|
|
REM --- 1. Verifier que Git est installe ---
|
|
where git >nul 2>nul
|
|
if errorlevel 1 (
|
|
echo [ERREUR] Git n'est pas installe sur ce PC.
|
|
echo.
|
|
echo Telechargez et installez "Git for Windows" ici :
|
|
echo https://git-scm.com/download/win
|
|
echo.
|
|
echo Laissez toutes les options par defaut pendant l'installation.
|
|
echo Une fois installe, relancez ce script en double-cliquant dessus.
|
|
echo.
|
|
pause
|
|
exit /b 1
|
|
)
|
|
echo [OK] Git est installe.
|
|
echo.
|
|
|
|
REM --- 2. Initialiser le depot si besoin ---
|
|
if exist ".git" (
|
|
echo Depot Git deja initialise.
|
|
) else (
|
|
echo Initialisation du depot Git...
|
|
git init
|
|
if errorlevel 1 (
|
|
echo [ERREUR] git init a echoue.
|
|
pause
|
|
exit /b 1
|
|
)
|
|
)
|
|
echo.
|
|
|
|
REM --- 3. Identite git locale (uniquement si pas deja configuree) ---
|
|
git config user.name >nul 2>nul
|
|
if errorlevel 1 git config user.name "Abdoul Ahad Binizi"
|
|
git config user.email >nul 2>nul
|
|
if errorlevel 1 git config user.email "abdoulahadbinizi+ahadquant@gmail.com"
|
|
|
|
REM --- 4. Ajouter tous les fichiers ---
|
|
echo Ajout des fichiers du projet...
|
|
git add .
|
|
echo.
|
|
|
|
REM --- 5. Commit (seulement s'il y a des changements) ---
|
|
git diff --cached --quiet
|
|
if errorlevel 1 (
|
|
git commit -m "Initial commit - AHAD QUANT v1"
|
|
) else (
|
|
echo Rien de nouveau a committer.
|
|
)
|
|
echo.
|
|
|
|
REM --- 6. Branche principale ---
|
|
git branch -M main
|
|
|
|
REM --- 7. Configurer le remote GitHub ---
|
|
git remote get-url origin >nul 2>nul
|
|
if errorlevel 1 (
|
|
git remote add origin https://github.com/AhadQuant/ahad-quant.git
|
|
) else (
|
|
git remote set-url origin https://github.com/AhadQuant/ahad-quant.git
|
|
)
|
|
|
|
REM --- 8. Push vers GitHub ---
|
|
echo Envoi vers GitHub...
|
|
echo Une fenetre de connexion (navigateur) va probablement s'ouvrir.
|
|
echo Connectez-vous avec le compte AhadQuant si elle apparait.
|
|
echo.
|
|
git push -u origin main
|
|
|
|
if errorlevel 1 (
|
|
echo.
|
|
echo ================================================
|
|
echo [ERREUR] Le push a echoue.
|
|
echo ================================================
|
|
echo Causes possibles :
|
|
echo - La connexion dans la fenetre du navigateur a ete annulee
|
|
echo - Vous n'etes pas connecte au compte AhadQuant
|
|
echo - Le depot distant contient deja des fichiers en conflit
|
|
echo.
|
|
pause
|
|
exit /b 1
|
|
)
|
|
|
|
echo.
|
|
echo ================================================
|
|
echo TERMINE
|
|
echo Verifiez ici : https://github.com/AhadQuant/ahad-quant
|
|
echo ================================================
|
|
echo.
|
|
pause
|