Using Github Enterprise

Github:Enterprise is used to interact with code for custom theming and site building.

The information below assumes:

  • You are well-versed in:
    • Drupal development
    • Git version control system
  • You have a command line Git client installed or use Windows / Mac graphical tools.
  • If you are not on campus, you will need to be connected to the Yale VPN

The below instructions can be adapted for the GUI GitHub client (Windows or Mac), or similar GUI Git client.

The following information is provided without support and is meant for Drupal developers only.

Identify yourself to Git

If you haven’t already, you must identify yourself to Git.

git config --global 'Your Name'
git config --global

Accessing Github:Enterprise

  1. Log in to GitHub:Enterprise using your Yale NetID and password.
  2. Enter an email address if you are prompted to do so, and fill out each field in your user profile.
  3. Add an SSH key to your account. You can use the support links at the top of the SSH key page if you need a tutorial.
  4. Next, you must create an organization.
    1. From your account settings, click Organizations > Create new organization.
    2. Give your organization a short name to identify your department or group.
    3. Put your email address in the Billing Email field. You will not be billed as this is just used for organization owner contact.

Adding users

If there are other users who need to access a repo, they will need to be added to your organization. The user must first log in to Github:Enterprise using their Yale NetID to create an account.

  1. Visit the Github:Enterprise home page.
  2. At the top left, click on your username to change your account context, and pick your organization.
  3. From the menu bar, click Teams.
  4. Next, click Owners.
  5. Enter the user’s Yale NetID or first name to add them as a team member.
  6. The user now has access to all repositories inside the organization.

Forking the repo

You must fork the main Drupal 7 repository to begin working with code.

  1. Fork the drupal/d7 repo. This is the master repository for Drupal 7 at Yale. To generate your fork, use the Fork button at the top right of the repo. Click Fork to [organization name].
  2. After the fork is built, click the Settings link in the right sidebar and rename the fork to match your site name in dev:
  3. Next, request a Jenkins deployment job be created for your site.

After your Jenkins job has been set up, code pushes to your fork will automatically trigger a deployment of the updated code to your dev site. It takes about 15 minutes for code to be deployed. You can verify the Jenkins job is working with following steps:

  1. Clone your forked repository to your local machine (must be on campus or connected to Yale VPN)
  2. Modify something simple (/sites/all/themes/yale_standard/css/custom.css), like adding a comment
  3. git add custom.css, git commit -m”made a change to custom.css”, git push, and wait 15 minutes
  4. Look at your site source css to see if the comment is there. 

Forking multiple times

Github:Enterprise allows for one forked instance from its interface. If you are an organization and need to fork the main Drupal 7 repo multiple times for different sites you are working on, you will need to follow these steps.

  1. Visit the Github:Enterprise home page.
  2. At the top left, click on your username to change your account context, and pick your organization.
  3. On the right, click the New repository button.
  4. In the “Repository Name” field, enter your sitename in the format:
  5. Do not check Initialize this repository with a README.
  6. Click Create Repository.
  7. Once complete, take note of the path to your repository. It is in the format
  8. Clone the drupal/d7 repo to your local machine:
    $ git clone
    Cloning into 'd7'...
    remote: Counting objects: 130784, done.
    remote: Compressing objects: 100% (31752/31752), done.
    remote: Total 130784 (delta 92178), reused 130771 (delta 92166)
    Receiving objects: 100% (130784/130784), 53.73 MiB | 9.46 MiB/s, done.
    Resolving deltas: 100% (92178/92178), done.
    Checking out files: 100% (9051/9051), done.
  9. Next, the remote repositories need to be renamed. We’ll rename origin to upstream and add the new empty repo we created as the origin. In the last line below, swap in the path to your repository from Step 6.
    $ cd d7
    $ git remote rename origin upstream
    $ git remote add origin
  10. Next, push the code from your local repository to your new remote repository. You only need to run this command with the -u parameter the first time.
    $ git push -u origin master
  11. You now have a local repository with remotes to the correct origin and upstream.
  12. Request a Jenkins job be created for your site.

Working with your repo

From your repo, you have access to modify themes and modules available to your site.

Please ONLY modify files within:

  • sites/all/themes
  • sites/all/modules/custom

Any other changes, such as changes to Drupal core, will NOT be merged upstream.

Updating your fork

Over time, changes will be made upstream to the drupal/d7 repo, such as Drupal core updates as well as module updates and additions. You will want to pull these changes in occasionally to keep your fork up to date.

For forked repositories

To create automatically create a comparison between your repository and the drupal/d7 repository, visit this URL, replacing {ORG} with your organization name:{ORG}:master…drupal:master

Next, click the ‘Create pull request’ button. This will create a new pull request to merge the changes from the drupal/d7 repo into your repo. Fill the title in with ‘Merge changes from upstream drupal/d7 repo’ and click ‘Send pull request’. This will open a pull request, and you can click the green ‘Merge pull request’ button to merge the changes into your repository. 

For non-forked repositories

This process is best done at the command line. It may also be possible to merge from an upstream remote inside a GUI Git client.

Configure remotes

When a repo is cloned, it has a default remote called origin that points to your fork on GitHub, not the original repo it was forked from. To keep track of the original repo, you need to add another remote named upstream. If you are working on a fork created from the instructions in the previous section, “Forking multiple times”, you can skip to “Fetch and merge upstream changes” below.

cd myrepository
git remote add upstream
Fetch and merge upstream changes

Fetch changes from your newly configured remote called upstream, and merge them, accepting all upstream changes.

git fetch upstream
git merge upstream/master -Xtheirs -m"Merge remote-tracking branch 'upstream/master'"
Push changes

Push changes to your remote repository.

git push origin master