Enhance git-pull script with logging and safe directory configuration
This commit is contained in:
@@ -1,7 +1,13 @@
|
||||
#!/bin/bash
|
||||
# Simple git pull script for webhook
|
||||
|
||||
cd /data/app/igny8
|
||||
git pull origin main
|
||||
git update-ref refs/remotes/origin/main HEAD
|
||||
# Git pull triggered by Gitea webhook
|
||||
|
||||
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
|
||||
echo "$(date '+%Y-%m-%d %H:%M:%S') - Git pull completed"
|
||||
} >> "$LOG_FILE" 2>&1
|
||||
|
||||
Reference in New Issue
Block a user