Skip to content

Instantly share code, notes, and snippets.

@cstielper
Last active December 12, 2018 19:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save cstielper/6e8126235cd8adbe024c72d772738e7d to your computer and use it in GitHub Desktop.
Save cstielper/6e8126235cd8adbe024c72d772738e7d to your computer and use it in GitHub Desktop.
MM4 Server GH Integration

MM4 Server GitHub Integration

WordPress Installation

  1. Install WordPress
  2. In the /wp-content/themes directory, create a folder that matches your theme's text-domain (make sure permissions are set to 755)

Add SSH Key to Server

  1. From your terminal, SSH into the server: ssh -p port user@IP
    1. port represents the port number
    2. user represents your CPanel username
    3. IP represents your IP address
  2. Generate the SSH key with the following command: ssh-keygen -t rsa -b 4096 -C "username@example"
    1. username represents the cPanel account username
    2. example represents the domain name
  3. After you run this command, the system will prompt you to enter a passphrase. Do not enter a passphrase, and press Enter to continue.
  4. To confirm that the key exists and is in the correct location, run the following command: cat ~/.ssh/id_rsa.pub
  5. The output should resemble the following example, where AAAAB3Nza... represents a valid SSH key: ssh-rsa AAAAB3Nza...
  6. Copy the entire key and keep it aside
  7. Log into CPanel and navigate to "SSH Access"
  8. Click "Manage SSH Keys" and "authorize" the public key

Add SSH Key to GitHub Repo

  1. Navigate to your repo
  2. Click "Settings"
  3. Click "Deploy Keys"
  4. Click "Add Deploy Key"
  5. Give your key a title
  6. Paste in the full SSH key
  7. Check the box to "Allow Write Access"
  8. Click "Add Key"

Set Up Repo in CPanel

  1. Click "Git Version Control"
  2. On the right hand side, click "Create"
  3. Enter the clone URL of your repo. It should be in the following format: ssh://git@ssh.github.com:443/GITHUB-USER-NAME/REPO-NAME.git
  4. Enter the path to where the repo should be cloned on the server. This should be the theme directory that you set up at the beginning.
  5. Click create

Updating files from GitHub

  1. From CPanel, click "Git Version Control"
  2. Click "Manage"
  3. Navigate to the "Pull or Deploy" tab
  4. Click "Update from Remote" to sync files on the server with the remote repo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment