Git & deploy·2 min read

Connect a GitHub repository to your website

Connect a GitHub, GitLab or Bitbucket repository to your website in DirectAdmin, with its own deploy key and a choice of where the files go.

If you work with Git, you want your website to show the code from your repository. DirectAdmin can do that with its Git feature, but that form asks for a "keyfile" and leaves you to figure out where everything goes. With the GitHub tab in Invoker Link it takes three steps.

Step 1: enter the repository

  1. Open Invoker Link and go to GitHub.
  2. Choose the website (subdomains are listed too).
  3. Enter the repository, for example github.com/your-company/website, and click Check.

A public repository doesn't need a key: you go straight to step 3.

Step 2: add a deploy key (private repository)

For a private repository the platform creates its own deploy key: a key that may only read this repository. GitHub only allows a key on one repository, so every repository gets its own key.

  1. Click Open GitHub. You land on the Deploy keys → Add deploy key page of your repository.
  2. Copy the title and the key from DirectAdmin and paste them into GitHub.
  3. Leave Allow write access off. Reading is enough for deploying.
  4. Click Add key.

Keep DirectAdmin open: the page notices by itself when GitHub accepts the key and moves on to step 3.

Step 3: choose the branch and location

Choose the branch (usually main) and where the files go:

Choice When
The website itself (public_html) A static site: HTML, CSS, JavaScript, or a built dist folder.
A subfolder A WordPress theme or plugin, for example wp-content/themes/my-theme.
Outside the website Source code that doesn't belong online, such as a Next.js or Node project with .env files.

Click Connect and publish. The repository is fetched and the files are placed in the chosen location straight away.

Are there already files in the target folder? Then the platform asks first. Files with the same name as in the repository are saved before being overwritten; everything else stays.

What should you know?

  • A Next.js or Node project doesn't run as a server on shared hosting. Put the source code outside the website, or build it elsewhere and connect the built files.
  • A .git folder in your website can't be requested by visitors: the web server blocks it.
  • Deleted files stay. If you remove a file from your repository, delete it from the website too.
  • The connection also shows up in DirectAdmin → Git.

Updating

Click Update now to fetch the latest version. Want it to happen automatically after every push? Turn on automatic deploys with a webhook.

Prefer the terminal?

git-link yoursite.com github.com/your-company/website --wait
git-deploy yoursite.com

--wait waits until you've added the deploy key on GitHub and then connects straight away.

MK
Maarten Keizer

Founder of Invoker. Over twenty years in hosting, system administration and web development; builds the Claude hosting himself and tests everything on our own servers first.

about maarten