We are aware of a potentially service impacting issue. Learn more

How to connect and use github with DirectAdmin Print

  • 0

Clone Your GitHub Repository in DirectAdmin

Step 1: Initialize a New GitHub Repository (if don't have one, however, if you do, you can skip this step and proceed to step 2)

  1. Log in to GitHub: Open your GitHub account and navigate to the "Repositories" tab.
  2. Start a New Repository: Click the "New" button.
  3. Configuration: Name your repository and optionally provide a description. Choose the visibility as public or private.
  4. Additional Settings: It's good practice to initialize the repository with a README file. You may also add a license and a .gitignore file at this stage.
  5. Create: Click "Create repository."

Step 2: Secure Connections with SSH Keys (Recommended)

SSH keys provide an added layer of security and are recommended for secure communications between your local machine and the server.

You need to generate your SSH public key to connect your GIT.

See the steps: https://www.whogohost.com/host/index.php?rp=/knowledgebase/755/How-to-Generate-an-SSH-Key-and-Connect-to-Your-DirectAdmin-Hosting-Account.html

Step 3: Clone Your GitHub Repository in DirectAdmin

  1. Access File Manager: Go to "Files" > "File Manager" in your DirectAdmin panel.
  2. Create Directory: Make a directory to house your GitHub repository, and navigate into it.
  3. Open Terminal: Either open the built-in "Terminal" in DirectAdmin or connect via an SSH client (you can connect using PuTTY; see Instructions). 
  4. Clone Command: 

    N:B Replace username and repository with your GitHub details.

    git clone git@github.com:username/repository.git

Step 4: Git Configuration and User Details

  1. Navigate to Repo Directory:

cd path/to/cloned/repo

Set Git User:
git config --global user.name "Your Name"
git config --global user.email "your-email@example.com"

Step 5: Managing Changes - Pull and Push

1. Pull Changes:
git pull origin main

2. Add and Commit Changes:
git add
git commit -m "Commit message here"

3. Push Changes:
git push origin main

Conclusion and Next Steps

You've successfully set up a GitHub repository linked to your DirectAdmin End User Panel. This robust setup will significantly simplify your workflow, offering a centralized version control system for all your web assets. Happy coding!

You can use the public key you have generated. 

 

  • BONUS:
    The below command will:
    Fetch the latest changes from GitHub.
    Force your working directory to match the remote exactly.
    Erase any uncommitted local changes or deletions.

git reset –hard origin/main


Was this answer helpful?

« Back