Pantheon Git Documentation
Please refer to Pantheon's documentation on how to use Git for websites hosted on Pantheon:
- Git on Pantheon Guide
- Pantheon Build Tools (GitHub with GitHub Actions or CircleCI, GitLab with GitLabCI, or BitBucket with BitBucket Pipelines)
- The Pantheon WebOps Workflow explains how and why code is managed in Git, but assets, uploads, and other files are not managed in Git.
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?
- Start with the U-M specific instructions.
- 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.
- 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.
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
andpantheon.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.
- WordPress sites have Pantheon-provided files in
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 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
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.
- Set up a GitHub Action to push changes to Panthenon automatically.
- Optional but recommended: Set up a Pantheon Quicksilver workflow action paired with another GitHub Action to push changes made by Pantheon (for example, via Autopilot) to your GitHub repo.
- The PHP file should be put in the directory
private/scripts
to prevent it from being executed by website visitors. Be sure to specify this path in the Quicksilver action.
- The PHP file should be put in the directory
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.