From a4d0233386991e091f991139febfee4c13cf7cbf Mon Sep 17 00:00:00 2001 From: dyzulk <66510723+dyzulk@users.noreply.github.com> Date: Sat, 17 Jan 2026 13:47:09 +0700 Subject: [PATCH] fix: Resolve Git ownership, Composer, and npm environment issues in the deployment script and add cleanup for temporary files. --- aapanel_deploy.sh | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/aapanel_deploy.sh b/aapanel_deploy.sh index 185ed88..31c4841 100644 --- a/aapanel_deploy.sh +++ b/aapanel_deploy.sh @@ -17,17 +17,23 @@ cd $PROJECT_PATH || exit # 1. Pull latest changes echo "Step 1: Pulling latest changes from Git..." -git pull origin main # Adjust branch name if necessary +# Fix for dubious ownership error +git config --global --add safe.directory $PROJECT_PATH +git pull origin main # 2. Install PHP dependencies if [ -f "composer.json" ]; then echo "Step 2: Installing PHP dependencies..." + # Set COMPOSER_HOME to avoid environment variable errors + export COMPOSER_HOME="$PROJECT_PATH/.composer" composer install --no-interaction --optimize-autoloader --no-dev fi # 3. Build Assets if [ -f "package.json" ]; then echo "Step 3: Building assets..." + # Set HOME for npm/node environment + export HOME="$PROJECT_PATH" # If node_modules doesn't exist, install first if [ ! -d "node_modules" ]; then npm install @@ -44,6 +50,10 @@ chmod -R 755 public if [ -d "storage" ]; then chmod -R 775 storage fi +# Cleanup composer home if created +if [ -d ".composer" ]; then + rm -rf .composer +fi echo "---------------------------------------" echo "Deployment Finished Successfully!"