Git deploy

If your website code is in a Git repository (GitHub, GitLab or similar), you can publish it without FTP: with one click the website's www folder matches the latest version of a branch. In the dashboard: Hosting → website name → Git.

Available for PHP and static websites.

Connect the repository

  1. Click + Connect repository.
  2. In Repository write the address:
    • public repository: https://github.com/user/project.git;
    • private repository: git@github.com:user/project.git (it needs the deploy key, see below).
  3. In Branch write the branch to publish (empty = main) and save.

Never put a username and password or a token in the address: private repositories use the deploy key.

Private repository: the deploy key

After connecting a git@… address, the Deploy key box shows a public key created for your website. Copy it and add it to the repository as read-only:

  • GitHub: repository → Settings → Deploy keys → Add deploy key (leave «Allow write access» off);
  • GitLab: project → Settings → Repository → Deploy keys.

The key only gives read access to that repository.

Update the website

Click Update from Git and confirm. Within seconds the page updates by itself and shows the published version (commit, message and date) or the Git error.

  • The first time the www folder must be empty: empty it via FTP if it already contains files. This way we never delete anything of yours.
  • Afterwards, repository files go back to the latest version of the branch: manual changes to those files (for example via FTP) are lost. Files that are not in the repository, such as images uploaded by the website, are kept.
  • After the update we don't run commands such as composer install or npm run build: put files that are ready for the website in the repository.

The website's .git folder can't be reached from the web.

Disconnect

Disconnect removes the link to the repository and the deploy key. The website files stay as they are.

Didn't find the answer? Write to us