From 5a98fa628db1129abf4ec8b708f29f7474c47c0d Mon Sep 17 00:00:00 2001 From: marco370 <48531002-marco370@users.noreply.replit.com> Date: Thu, 16 Oct 2025 11:08:17 +0000 Subject: [PATCH] Improve deployment script to prevent push conflicts Add a git pull before pushing to production to synchronize remote changes and avoid conflicts. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 42d8028a-fa71-4ec2-938c-e43eedf7df01 Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/6d543d2c-20b9-4ea6-93fe-70fe9b1d9f80/42d8028a-fa71-4ec2-938c-e43eedf7df01/aazyBOE --- ...lfacom-it--1760612848127_1760612848127.txt | 46 +++++++++++++++++++ push-to-gitlab.sh | 5 ++ 2 files changed, 51 insertions(+) create mode 100644 attached_assets/Pasted--workspace-push-to-gitlab-sh-Push-to-GitLab-vt-alfacom-it--1760612848127_1760612848127.txt mode change 100755 => 100644 push-to-gitlab.sh diff --git a/attached_assets/Pasted--workspace-push-to-gitlab-sh-Push-to-GitLab-vt-alfacom-it--1760612848127_1760612848127.txt b/attached_assets/Pasted--workspace-push-to-gitlab-sh-Push-to-GitLab-vt-alfacom-it--1760612848127_1760612848127.txt new file mode 100644 index 0000000..bbca23f --- /dev/null +++ b/attached_assets/Pasted--workspace-push-to-gitlab-sh-Push-to-GitLab-vt-alfacom-it--1760612848127_1760612848127.txt @@ -0,0 +1,46 @@ + +~/workspace$ ./push-to-gitlab.sh +🚀 Push to GitLab (vt.alfacom.it) +======================================== + +📋 Modifiche da committare: + M .replit + M push-to-gitlab.sh +Vuoi procedere con il push? (y/N) y +Messaggio commit personalizzato (Enter per default): + +📦 Git add... +💾 Git commit... +On branch main +nothing to commit, working tree clean +~/workspace$ git add . +~/workspace$ git commit -m "Deploy: $(date '+%Y-%m-%d %H:%M:%S')" +On branch main +nothing to commit, working tree clean +~/workspace$ git push production main +error: unable to read askpass response from 'replit-git-askpass' +Username for 'https://git.alfacom.it': marco@lanzara.eu +error: unable to read askpass response from 'replit-git-askpass' +Password for 'https://marco%40lanzara.eu@git.alfacom.it': +To https://git.alfacom.it/marco/VigilanzaTurni.git + ! [rejected] main -> main (fetch first) +error: failed to push some refs to 'https://git.alfacom.it/marco/VigilanzaTurni.git' +hint: Updates were rejected because the remote contains work that you do not +hint: have locally. This is usually caused by another repository pushing to +hint: the same ref. If you want to integrate the remote changes, use +hint: 'git pull' before pushing again. +hint: See the 'Note about fast-forwards' in 'git push --help' for details. +~/workspace$ git push production main +error: unable to read askpass response from 'replit-git-askpass' +Username for 'https://git.alfacom.it': marco +error: unable to read askpass response from 'replit-git-askpass' +Password for 'https://marco@git.alfacom.it': +To https://git.alfacom.it/marco/VigilanzaTurni.git + ! [rejected] main -> main (fetch first) +error: failed to push some refs to 'https://git.alfacom.it/marco/VigilanzaTurni.git' +hint: Updates were rejected because the remote contains work that you do not +hint: have locally. This is usually caused by another repository pushing to +hint: the same ref. If you want to integrate the remote changes, use +hint: 'git pull' before pushing again. +hint: See the 'Note about fast-forwards' in 'git push --help' for details. +~/workspace$ \ No newline at end of file diff --git a/push-to-gitlab.sh b/push-to-gitlab.sh old mode 100755 new mode 100644 index b811caf..9080404 --- a/push-to-gitlab.sh +++ b/push-to-gitlab.sh @@ -56,6 +56,11 @@ echo -e "${GREEN}💾 Git commit...${NC}" git commit -m "$COMMIT_MSG" echo -e "${GREEN}📤 Git push to production...${NC}" + +# Pull prima di pushare per evitare conflitti +echo -e "${YELLOW}Sincronizzazione con remote...${NC}" +git pull production main --no-rebase || echo -e "${YELLOW}⚠️ Potrebbero esserci conflitti da risolvere${NC}" + git push production main echo -e "\n${GREEN}✅ Push completato!${NC}"