Skip to content

Instantly share code, notes, and snippets.

@anavdesign
Created January 19, 2019 20:05
Show Gist options
  • Save anavdesign/59bd55a9029c43541303b54da26a524b to your computer and use it in GitHub Desktop.
Save anavdesign/59bd55a9029c43541303b54da26a524b to your computer and use it in GitHub Desktop.
Drupal: Git Repo

Drupal Git Repo

Remote and Local Repo Setup

  1. Initiate Remote Repo

    $ ssh ALIAS
    $ mkdir /git/DOMAINNAME && cd /git/DOMAINNAME
    
    # Initialized empty Git repository in /var/git/myapp.git
    $ git init --bare
    
  2. Local Repo

    1. Initiate Local Repo

      $ cd ~/www/sites/NAME/
      $ git init
      $ git add .
      $ git commit -m 'initial commit'
      
    2. Add a Remote Origin

      $ git remote add origin ssh://ALIAS/PATH/TO/REMOTE/REPO
      
    3. Push Local Repo to Remote

      $ git push -u origin master
      

Remote Repo

  1. Clone Repo

    $ ssh alias
    $ cd ~/public_html/DOMAIN_NAME
    
    # Clone Repo
    $ git clone ~/git/REPO_NAME CLONE_NAME
    
  2. Install Drupal

    # Move into the directory where composer.json is located
    $ cd DOMAIN_NAME
    
    # Install
    $ composer install
    
  3. Site Settings

    Copy site settings from local to drupal/web/sites/default/settings.php

    scp web/sites/default/settings.php ALIAS:/PATH/TO/SITE/www/web/sites/default/settings.php
    
    • Add Trusted host configuration
    • Comment out local development settings
    • Add Database Array
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment