Deploy Keys

The app needs read access to every repository it deploys. Public repositories need nothing extra: use the HTTPS address, such as https://github.com/you/site.git. For a private repository, the app connects over SSH with a deploy key: a key pair the app creates, whose public half you add to the repository on GitHub. The key can read that one repository and nothing else on your account.

The server needs an SSH client and ssh-keygen for this. The app's Diagnostics page doesn't check for either. If ssh-keygen is missing, Generate Deploy Key fails with "Failed to generate SSH key". If the SSH client is missing, the clone fails with Git's error in its log.

Set up a deploy key

  1. Use the SSH address

    Create the project with the repository's SSH address, such as git@github.com:you/site.git. On GitHub, you'll find it under Code, then SSH. The deploy key is only used over SSH, so a project created with the HTTPS address of a private repository can't clone it. A project's address can't be changed, so in that case create a new project with the SSH address.

  2. Generate the key

    In the project's Settings, under Repository Access, choose Generate Deploy Key. The section then shows the public key, which starts with ssh-ed25519. You can also generate it from the repository's Access tab.

  3. Add the public key on GitHub

    Choose the Deploy Keys link in the text above the key to open the repository's deploy key settings. You can also get there from the repository's page on GitHub: Settings, then Deploy keys. Choose Add deploy key, give it a title such as the address of your installation, and paste the public key. Leave Allow write access off: the app only reads.

  4. Clone

    Back in the app, choose Clone Repository on the project's Overview.

One key per repository

The key belongs to the repository record, not to a single project, so every project on the same repository uses it. If you deploy main and staging from one repository, you add the key on GitHub once. See Repositories.

GitHub accepts a deploy key on one repository only. To deploy several private repositories, generate a key for each one and add each key to its own repository.

Delete or replace a key

To delete a key, use Delete key in the menu of the project's Repository Access section, or Delete Key on the repository's Access tab. Every project on that repository loses access until you generate a new key and add it on GitHub. Your deployed sites keep running, but clones, pulls and webhook deploys fail.

To replace a key, delete it, generate a new one and add the new one on GitHub. Then delete the old key on GitHub, since it no longer works.

How the key is kept

The app creates an Ed25519 key pair with ssh-keygen. The private key never leaves your server: it's stored in the app's storage folder, readable only by its owner, and the web server refuses requests for anything in that folder. The app shows only the public key.

The first time the app connects to a Git host over SSH, it records the host's fingerprint, and later connections check against it. That needs OpenSSH 7.6 or newer on the server. With an older version, the app connects without checking the fingerprint. See Security.

Other Git hosts

Deploy keys work the same way on GitLab, Bitbucket and other hosts that offer them: create the project with the SSH address, generate the key and add the public key in the host's deploy key settings. Bitbucket calls them access keys. The Deploy Keys shortcut link only appears for GitHub repositories.

Deploying on every push needs a GitHub webhook. Webhooks from other hosts aren't supported, so there you deploy with Pull Latest Changes.