/
GitHub Tutorial for Drupal Development

GitHub Tutorial for Drupal Development

Basic GitHub Tutorial for Drupal Development in a Local Environment

The purpose of this tutorial is to go over basic command line instructions to clone, and push/pull commits to an existing Drupal project (Part 1). We will also go over instructions to login at lib-web-dev1 and pull our changes for drupal-dev.library.oregonstate.edu (Part 2)

The following steps assume that you already have a proper apache-mysql-php local development environment, including drush and GitHub with proper deploy-php access to our server lib-web-dev1 (See notes at the end)

Part 1: Push a commit to drupal-visualization repository

  1. Clone existing drupal-visualization Drupal project from github.com/osulp

    git clone git@github.com:osulp/drupal-visualization.git
    cd drupal-visualization
     
  2. Install Views module via drush

    drush dl views
    


  3. Enable Views module to install module and dependencies

    drush en views
    
  4. Create a new branch called "feature/ViewsModule"

    git checkout -b feature/ViewsModule
    
  5. Add all new files for our commit

    git add --all
    
  6. Generate a commit with a message

    git commit -m "added views module"
    
  7. Push commit to our new branch

    git push -u origin feature/ViewsModule
    
  8. Go to https://github.com/osulp/drupal-visualization and create a pull request for our new branch featureViewsModule and merge to master branch

Part 2: Pull changes from master in lib-web-dev1

 

  1. From your local dev environment, login to lib-web-dev1.library.oregonstate.edu as deploy-php via ssh

    ssh deploy-php@lib-web-dev1.library.oregonstate.edu
    
  2. Go to drupal-visualization html folder

    cd /var/www/drupal-dev.library.oregonstate.edu/drupal-visualization
    
  3. Backup existing database

    drush sql-dump > /var/www/drupal-dev.library.oregonstate.edu/backup-7-29-16.sql
    
  4. Pull changes from git

    git pull origin master
    
  5. Dump the updated database into the server database (use this only to recover or reset the drupal database)

    mysql -udrupal -h lib-mysql4.library.oregonstate.edu -p drupal_dev < /path/to/local/drupal_visualization.sql
    Note: the password can be found in lib-web-dev1 in the drupal settings.php at /var/www/drupal-dev.library.oregonstate.edu/drupal_visualization/sites/default/settings.php

  6. Login at drupal-dev.library.oregonstate.edu/user to double check the updates

Notes

Apache-PHP-MySQL Dev Setup in Windows

For local development in Windows, you can use XAMPP (https://www.apachefriends.org/index.html) which comes with Apache, MariaDB (used instead of MySQL), PHP, and Perl. It also includes other useful tools such as Phpmyadmin, which is great for managing local databases.

Apache-PHP-MySQL Dev Setup in Mac OS X

For local development in Mac OS X Yosemite, you would need Apache, MySQL, PHP installed. You can follow this guide to install the required tools: https://coolestguidesontheplanet.com/get-apache-mysql-php-phpmyadmin-working-osx-10-10-yosemite/

Other tools

Github: https://desktop.github.com/

Drush: http://docs.drush.org/en/master/install/

WinSCP (for Windows): http://oregonstate.edu/helpdocs/osu-applications/offered-apps/ftp

PuTTY (for ssh on Windows): http://engineering.oregonstate.edu/computing/fileaccess/putty_ssh/ 

Become a member of deploy-php in lib-web-dev1

To access our lib-web-dev1 server, you will need to be a member of deploy-php user. To become a member, you will need to send your public key (id_rsa.pub) generated in your local environment to Margaret Mellinger (margaret.mellinger@oregonstate.edu) in order to approve your membership. To generate your public key, you can follow the instructions at https://help.github.com/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent/#platform-mac

 

Related content

Continuous Integration (Drupal)
Continuous Integration (Drupal)
More like this
Drupal Sites and Versions (archived)
Drupal Sites and Versions (archived)
More like this
Student Development Environment (mac)
Student Development Environment (mac)
More like this
Drupal 8 Development structure
Drupal 8 Development structure
More like this