508 B
508 B
Automate update via Git Hook
- Navigate to the bare repository:
cd ~/git/asobi.git/hooks
- Create
post-receiveHook:
nano post-receive
- Add script you want to run:
#!/bin/bash
# Deployment directory
DEPLOY_DIR="/home/nik/repo/asobi"
# Navigate to the deployment directory
cd $DEPLOY_DIR
# Pull the latest changes
git pull origin main
# Restart the service
sudo systemctl restart asobi-web.service
- Make the hook executable:
chmod +x post-receive