Enhance git-pull script with logging and safe directory configuration

This commit is contained in:
IGNY8 VPS (Salman)
2025-11-10 11:43:43 +00:00
parent f9320cfbb8
commit 17801c2ab7

View File

@@ -1,7 +1,13 @@
#!/bin/bash
# Simple git pull script for webhook
# Git pull triggered by Gitea webhook
cd /data/app/igny8
LOG_FILE="/tmp/git-pull.log"
{
echo "$(date '+%Y-%m-%d %H:%M:%S') - Git pull started"
cd /data/app/igny8 || exit 0
git config --global --add safe.directory /data/app/igny8 2>/dev/null || true
git config --global --add safe.directory /data/app/igny8/backend 2>/dev/null || true
git config --global --add safe.directory /data/app/igny8/frontend 2>/dev/null || true
git pull origin main
git update-ref refs/remotes/origin/main HEAD
echo "$(date '+%Y-%m-%d %H:%M:%S') - Git pull completed"
} >> "$LOG_FILE" 2>&1