Deploy with Git

git, version control, clone, github, deploy key, pull · 0 found this helpful

Git repositories in the Developer section keep a repository on your account and can deploy it to your site. Typical use is to push to GitHub, then pull on the server to update your website.

Before you start

Clone a repository

  1. Open Account → Hosting → your site → Developer.
  2. Under Git repositories, click New repository.
  3. Enter a Name, such as site.
  4. Set the Folder, such as repositories/site. Keep it outside public_html.
  5. Under Clone from, enter the address of your repository, or leave it blank for an empty repository you push to:
Repo type Address format
Public (HTTPS) https://github.com/northshorebakery/site.git
Private (SSH) [email protected]:northshorebakery/site.git
  1. Click Create repository.
Git repositories in Developer

Private repositories: deploy key

  1. In SSH, create a key for this repo only:
ssh-keygen -t ed25519 -f ~/.ssh/deploy_site -N ""
cat ~/.ssh/deploy_site.pub
  1. In GitHub: Repository → Settings → Deploy keys → Add deploy key. Paste, leave write access off.
  2. Tell SSH to use it. Add to ~/.ssh/config:
Host github-site
    HostName github.com
    User git
    IdentityFile ~/.ssh/deploy_site
    IdentitiesOnly yes
  1. Use git@github-site:northshorebakery/site.git as the clone URL.

Pull updates

  1. Open Account → Hosting → your site → Developer and find the repository under Git repositories.
  2. Click Pull to run git pull.
  3. Click Deploy to run the deployment tasks. The button appears when the repository has a deploy file. See Automatic deployment from Git.

Copy clone URL gives you the address to push to from your computer.

From a terminal:

cd ~/repositories/site
git pull origin main
git log --oneline -5

Deploy from your computer instead

Add the server as a remote and push:

git remote add barbrick ssh://[email protected]:1988/home/yourusername/repositories/site
git push barbrick main

Pushing needs SSH, which comes with Business and Pro. Your hosting username is shown in Developer. If the repository has a deploy file, the push deploys automatically. Otherwise click Deploy.

Good practice

  • Add .gitignore for secrets, vendor, and node_modules.
  • Keep .env and wp-config.php out of Git.
  • Test on staging first. See A safe development workflow.

If something goes wrong

Problem Fix
Permission denied (publickey) Key isn't authorized for that repo
"Cannot deploy: uncommitted changes" Files were edited on the server. Commit or git checkout .
Branch not found The repository default may be main or master. Check with git branch -a
No Deploy button The repository has no deploy file in its root. See Automatic deployment from Git

Was this helpful?

Still stuck? Ask us and we'll walk you through it.