DirectAdmin + GitHub Setup Guide
1. Create SSH Key in DirectAdmin
Log in to DirectAdmin and go to:
SSH Keys → Create Key
Use recommended settings:
Key name: github
Authorize: not needed
Key size: 4096 bit
Password: empty
After the key is created, download the public key.
2. Create GitHub Repository
Create a new repository in GitHub.
Recommended repository name:
your-domain.com
Example:
example.com
Recommended settings:
Visibility: Private
License: Add a license if the project should be reused, shared, or open-sourced
For most client websites, we recommend using a private repository, because the website code is usually not meant to be public.
A license is not required for GitHub deployment to work. However, adding a license is useful if the project may be shared or reused later. Without a license, default copyright rules apply, meaning others do not automatically receive permission to use, copy, or modify the code.
3. Copy GitHub SSH Remote URL
After creating the repository, copy the SSH remote URL.
It should look like this:
git@github.com:YOUR_GITHUB_USERNAME/YOUR_REPOSITORY.git
Example:
git@github.com:company/example.com.git
4. Add Deploy Key to GitHub
In GitHub, open the repository and go to:
Settings → Deploy keys → Add deploy key
Title: DirectAdmin deploy key
Key: public key from DirectAdmin
Write access is not required because DirectAdmin only pulls files from GitHub.
5. Create and Configure Repository in DirectAdmin
In DirectAdmin, go to:
Git → Create Repository
Enter your GitHub repository details:
Remote:
git@github.com:<your_username>/<your_repository>.git
Keyfile:
.ssh/<your_key_name>_rsa
Example:
Remote:
git@github.com:company/example.com.git
Keyfile:
.ssh/github_rsa
Then click edit and configure deployment settings:
Deploy branch:
main
Deploy directory:
domains/<your_domain>/public_html
Example:
domains/example.com/public_html
Save the settings and copy the Webhook URL from DirectAdmin.
6. Add Webhook in GitHub
In GitHub, go to:
Settings → Webhooks → Add webhook
Use:
Payload URL: Webhook URL copied from DirectAdmin
Content type: application/json
Event: Just the push event
Active: yes
This allows GitHub to notify DirectAdmin when changes are pushed.
7. Add Website Files to GitHub
Before testing deployment, make sure the repository contains the website files.
For a simple website, the repository should include files such as:
index.html
style.css
assets/
.htaccess
The index.html file should be in the main repository folder, not inside another folder.
Commit and push the files to the main branch.
8. Test Deployment
In DirectAdmin Git Manager:
1. Click Fetch.
2. Click Deploy.
3. Open the website in a browser.
4. Push a small change to GitHub.
5. Check that the website updates automatically.
Website files should be deployed to:
domains/<your_domain>/public_html