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
This commit is contained in:
parent
22ce619ca5
commit
5a98fa628d
@ -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$
|
||||||
5
push-to-gitlab.sh
Executable file → Normal file
5
push-to-gitlab.sh
Executable file → Normal file
@ -56,6 +56,11 @@ echo -e "${GREEN}💾 Git commit...${NC}"
|
|||||||
git commit -m "$COMMIT_MSG"
|
git commit -m "$COMMIT_MSG"
|
||||||
|
|
||||||
echo -e "${GREEN}📤 Git push to production...${NC}"
|
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
|
git push production main
|
||||||
|
|
||||||
echo -e "\n${GREEN}✅ Push completato!${NC}"
|
echo -e "\n${GREEN}✅ Push completato!${NC}"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user