fix: auto-fix git permissions before pull in deployment
- Check if .git/FETCH_HEAD has write permission issues - Auto-fix with sudo chown if needed - Prevents "Permission denied" errors during git pull - Ensures deployment user owns .git directory Fixes deployment error: "error: cannot open '.git/FETCH_HEAD': Permission denied"
This commit is contained in:
@@ -29,6 +29,13 @@ jobs:
|
|||||||
echo "🚀 Deploying to server..."
|
echo "🚀 Deploying to server..."
|
||||||
echo "📥 Pulling latest changes..."
|
echo "📥 Pulling latest changes..."
|
||||||
cd $REPO_PATH
|
cd $REPO_PATH
|
||||||
|
|
||||||
|
# Fix git permissions if needed
|
||||||
|
if [ -f .git/FETCH_HEAD ] && [ ! -w .git/FETCH_HEAD ]; then
|
||||||
|
echo "🔧 Fixing git permissions..."
|
||||||
|
sudo chown -R $USER:$USER .git
|
||||||
|
fi
|
||||||
|
|
||||||
git pull origin main
|
git pull origin main
|
||||||
|
|
||||||
echo "🔄 Restarting service..."
|
echo "🔄 Restarting service..."
|
||||||
|
|||||||
Reference in New Issue
Block a user