streamlit_app / git_push_main.sh
p2ov's picture
Commit automatique via script
d3f5c49
#!/bin/bash
# 🔧 CONFIGURATION : modifie ici si nécessaire
REPO_SSH_URL="git@github-quality-air:devpoov/quality-air.git" # ← À personnaliser
BRANCH="main"
echo "🔎 Vérification de la connexion SSH à GitHub..."
ssh -T git@github.com 2>&1 | grep -q "successfully authenticated"
if [ $? -ne 0 ]; then
echo "❌ Problème de connexion SSH à GitHub. Vérifie ta clé SSH."
exit 1
else
echo "✅ Connexion SSH OK."
fi
echo "🔁 Configuration de l’URL distante vers : $REPO_SSH_URL"
git remote set-url origin "$REPO_SSH_URL"
echo "🔍 Vérification de la branche actuelle..."
CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
if [ "$CURRENT_BRANCH" != "$BRANCH" ]; then
echo "📛 Branche actuelle : $CURRENT_BRANCH → renommage en $BRANCH"
git branch -m "$BRANCH"
else
echo "✅ Branche actuelle : $BRANCH"
fi
echo "➕ Ajout des fichiers..."
git add .
echo "💬 Commit des changements..."
git commit -m "Commit automatique via script" || echo "(Aucun nouveau commit à faire)"
echo "🚀 Push vers GitHub..."
git push -u origin "$BRANCH"
echo "✅ Tout est en ordre. Branche '$BRANCH' poussée vers GitHub."