Pantheon and Git

Pantheon Git Documentation

Please refer to Pantheon's documentation on how to use Git for websites hosted on Pantheon:

Frequently Asked Questions about Pantheon and Git

I'm already using Git for a website I'm migrating to Pantheon. How can I merge my repo and Pantheon's Git repo?

  1. Start with the U-M specific instructions.
  2. When you get to the section "Migrate an existing website", follow Pantheon's manual migration procedure to move your existing website to Pantheon, starting with the "Import Your Code" step.
  3. Do not follow the SFTP instructions in Pantheon's manual migration instructions, instead, follow the steps on that page to move your existing Git content into Pantheon's git.
Do not move your wp-content/uploads directory (for WordPress websites) or your sites/default/files directory (for Drupal websites) into the Pantheon git repo, as Pantheon handles these separately.  Pantheon's git is only for "code", not static assets or uploads.  For details, refer to the Pantheon Filesystem documentation and the Pantheon WebOps Workflow.

Pantheon has some files in their Git repo that you should not delete when migrating your Git repo content, including

  • pantheon.yml and pantheon.upstream.yml
  • private
  • Code to integrate the CMS into the Pantheon environment
    • WordPress sites have Pantheon-provided files in wp-content/mu-plugins that integrate WordPress with Pantheon's hosting infrastructure.

Do I have to use Pantheon's Git? / Can I keep using the Git repo I've always used?

Pantheon will only use its own Git repos for serving website content.  There is no way to have Pantheon serve content from a repo on GitHub or any other Git service.

However, you can use Pantheon's Git repository together with your own Git repo.  There are several ways to do this.

Pantheon Build Tools

Pantheon Build Tools have not been tested with U-M Pantheon yet but are officially supported by Pantheon.  Early U-M adopters may encounter problems. Contact [email protected] for the latest status.

Pantheon Build Tools uses the Terminus Build Tools Plugin to create new websites on Pantheon that are integrated with a non-Pantheon Git repo.  Because U-M Pantheon requires website owners to use the ITS Web Hosting portal to create websites in the Regents of the University of Michigan Pantheon workspace, you will need to use the terminus build:project:create command to create the website in your Pantheon Personal Workspace, and then contact [email protected] to have the website moved to the Regents of the University of Michigan workspace so it will be eligible for Diamond Support and the university's discounted Pantheon rate plans.

Pantheon Build Tools will likely be more complex to set up and use than the custom integration option below.

Custom GitHub repo integration

The procedures at the links below have not been tested with U-M Pantheon yet but should work.  This is not supported by Pantheon. Contact [email protected] for assistance.

Follow the instructions in the articles below to integrate a GitHub repo with Pantheon. This sets up GitHub to be the place where the website team makes changes; those changes are then pushed to Pantheon.

Pantheon Collaborative Development with an External Repository documentation

This guide shows how you can set up your website to allow changes from Pantheon to be manually pushed to GitHub by developers, and vice-versa.

How can I rename the primary branch name in Pantheon's Git repos from "master" to "main"?

Pantheon does not currently allow websites to have a primary branch named something other than "master", but there is an open feature request for this that you can vote up.

 

Tags: 
Last Updated: 
Saturday, February 10, 2024