Pull from a GitHub repository directly from the WordPress admin dashboard.
- Upload the
github-git-pullfolder to/wp-content/plugins/ - Activate the plugin via Plugins → Installed Plugins
- Go to Git Pull → Settings in the admin sidebar
| Setting | Description |
|---|---|
| Repository Path | Absolute path on the server to the directory containing .git (e.g. /var/www/html) |
| Branch | Branch to pull from (default: main) |
| Remote | Git remote name (default: origin) |
| Git Binary Path | Full path to git — run which git on your server |
| SSH Key Path | Optional — path to SSH private key if using SSH remotes |
# 1. Generate a deploy key for the www-data user
sudo -u www-data ssh-keygen -t ed25519 -C "lightsail-deploy" -f /var/www/.ssh/id_ed25519 -N ""
# 2. Print the public key — add this to GitHub repo → Settings → Deploy keys
sudo cat /var/www/.ssh/id_ed25519.pub
# 3. Fix permissions
sudo chown -R www-data:www-data /var/www/.ssh
sudo chmod 700 /var/www/.ssh
sudo chmod 600 /var/www/.ssh/id_ed25519
# 4. Test the connection as www-data
sudo -u www-data git -C /var/www/html pull origin mainSet SSH Key Path in the plugin settings to /var/www/.ssh/id_ed25519.
Update your git remote to embed the token:
cd /var/www/html
git remote set-url origin https://<YOUR_TOKEN>@github.com/<user>/<repo>.gitLeave SSH Key Path blank in settings.
- PHP
exec()must be enabled (not disabled inphp.ini) - The web server user (
www-data/apache) must have write access to the repo directory gitmust be installed on the server (sudo apt install git)
| Problem | Fix |
|---|---|
git binary not found |
Run which git and update the Git Binary Path setting |
Permission denied |
Check that www-data owns the .git directory |
Host key verification failed |
The SSH key path is set and the key is added to GitHub |
exec() disabled |
Contact host or check php.ini for disable_functions |