Deploy with Git
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
- A repository on GitHub, GitLab, or Bitbucket, or an empty one you'll create here.
- For private repositories, an SSH key. See Create and add SSH keys.
- A plan for the deployment folder. See Where your website files live.
Clone a repository
- Open Account → Hosting → your site → Developer.
- Under Git repositories, click New repository.
- Enter a Name, such as
site. - Set the Folder, such as
repositories/site. Keep it outsidepublic_html. - 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 |
- Click Create repository.
Private repositories: deploy key
- In SSH, create a key for this repo only:
ssh-keygen -t ed25519 -f ~/.ssh/deploy_site -N ""
cat ~/.ssh/deploy_site.pub
- In GitHub: Repository → Settings → Deploy keys → Add deploy key. Paste, leave write access off.
- Tell SSH to use it. Add to
~/.ssh/config:
Host github-site
HostName github.com
User git
IdentityFile ~/.ssh/deploy_site
IdentitiesOnly yes
- Use
git@github-site:northshorebakery/site.gitas the clone URL.
Pull updates
- Open Account → Hosting → your site → Developer and find the repository under Git repositories.
- Click Pull to run
git pull. - 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
.gitignorefor secrets,vendor, andnode_modules. - Keep
.envandwp-config.phpout 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 |
Still stuck? Ask us and we'll walk you through it.
