How to Connect Git Repository? Print

  • Git, Version Control, Deploy via Git, GitHub, Repository
  • 0

Using Git allows you to manage your code versions and easily deploy updates to your BurjHost server. Here are several methods to connect your Git repository.

Method 1: Clone via SSH (For VPS/Advanced Users)

  1. Log in via SSH to your server.

  2. Navigate to your web directory:
    cd ~/public_html

  3. Clone your repository:
    git clone https://github.com/username/repository.git .
    (The dot clones into the current directory. Omit it to clone into a subfolder).

  4. Set up a deploy hook or simply git pull to update.

Method 2: Using cPanel's Git Version Control
Many BurjHost cPanel installations include a "Git Version Control" interface.

  1. Log in to cPanel.

  2. In the "Files" section, click "Git Version Control."

  3. Click "Create" or "Add Repository."

  4. Enter Repository Details:

    • Clone URL: Your Git repository URL (HTTPS or SSH).

    • Repository Path: The directory where you want to clone (e.g., public_html).

    • Branch: Specify the branch to deploy (e.g., main or master).

  5. Click "Create."

  6. You can now "Pull" or "Deploy" updates directly from cPanel.

Method 3: Automated Deployments with GitHub Actions (Advanced)
Set up a CI/CD pipeline to automatically deploy when you push to GitHub.

  1. Create a GitHub Actions workflow file (.github/workflows/deploy.yml).

  2. Use FTP or SSH commands to sync files to your server on push events.

Example GitHub Action snippet (FTP deployment):

yaml
- name: Deploy to Server
  uses: SamKirkland/FTP-Deploy-Action@4.3.0
  with:
    server: ${{ secrets.FTP_SERVER }}
    username: ${{ secrets.FTP_USERNAME }}
    password: ${{ secrets.FTP_PASSWORD }}
    local-dir: ./ 
    server-dir: /public_html/

Was this answer helpful?

« Back

Powered by WHMCompleteSolution