ids.alfacom.it/deployment/fix_git_ownership.sh
marco370 cbeb5e666e Improve system update script with ownership fixes and better output
Update deployment script to automatically fix Git ownership issues, add backup for git.env, implement stash for local changes, and enhance output formatting for a clearer user experience.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: 7a657272-55ba-4a79-9a2e-f1ed9bc7a528
Replit-Commit-Checkpoint-Type: full_checkpoint
Replit-Commit-Event-Id: abc30983-39f6-45cf-b89b-5b3507bb3c27
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/449cf7c4-c97a-45ae-8234-e5c5b8d6a84f/7a657272-55ba-4a79-9a2e-f1ed9bc7a528/c9ITWqD
2025-11-17 16:03:32 +00:00

35 lines
1.2 KiB
Bash
Executable File

#!/bin/bash
# =============================================================================
# IDS - Fix Git Ownership Error
# =============================================================================
# Risolve: "fatal: detected dubious ownership in repository"
# =============================================================================
set -e
GREEN='\033[0;32m'
BLUE='\033[0;34m'
NC='\033[0m'
echo -e "${BLUE}"
echo "╔═══════════════════════════════════════════════╗"
echo "║ Git Ownership Fix ║"
echo "╚═══════════════════════════════════════════════╝"
echo -e "${NC}"
# Aggiungi /opt/ids come safe directory per root
echo -e "${BLUE}🔧 Configuro /opt/ids come safe directory...${NC}"
git config --global --add safe.directory /opt/ids
# Configura anche per utente ids
sudo -u ids git config --global --add safe.directory /opt/ids
echo -e "${GREEN}✅ Configurazione completata${NC}"
echo ""
echo "Repository configurati come safe:"
git config --global --get-all safe.directory
echo ""
exit 0