Automate git pull securely
✅ Best setup for your repo server (recommended): SSH deploy key
This is the standard production approach.
1. On the server: create an SSH key
ssh-keygen -t ed25519 -C "emblem-ergani-server"
Press Enter for default path:
/root/.ssh/id_ed25519
2. Show the public key
cat ~/.ssh/id_ed25519.pub
Copy it.
3. Add it to your GitHub repo
Go to:
👉 Repo → Settings → Deploy keys → Add key
Paste the key.
Important choice:
- ✔️ Enable “Allow write access” if server will push
- Otherwise leave it read-only (safer for production pulls)
4. Switch repo remote to SSH (on server)
Inside your project:
git remote set-url origin git@github.com:semantic-software/emblem-ergani.git
5. Test authentication
ssh -T git@github.com
You should see:
Hi semantic-software! You've successfully authenticated...
6. Now automation works (no password ever)
git pull origin main
🤖 Automate it (cron / deploy hook)
Example cron (pull every minute)
crontab -e
* * * * * cd /var/www/emblem-ergani && git pull origin main
No comments to display
No comments to display