Skip to content

Step 3: Set Up GitHub

We recommend creating a GitHub repository for each project you’re working on—a theme, a plugin, or a full site. You can create a free GitHub account and then set up as many public or private repositories as you like. GitHub will give you the flexibility of version control and can effortlessly sync with your WordPress.com production or staging site.

This development workflow is recommended for most use cases, but an alternative option is Studio Sync. This feature allows you to synchronize a complete WordPress.com site with a local Studio site in either direction without requiring GitHub. Studio Sync can also complement GitHub-based development workflows for added flexibility.

There are many ways to add your code to a GitHub repository, like using the command line. However, we recommend using GitHub Desktop, a free app that serves as a GUI for your commits and pull requests. It allows you to seamlessly interact with your local site files and GitHub repositories through an intuitive visual interface.

The tutorials below will cover this workflow.

If You’re Working on a Theme

First, you’ll need to create a local repository inside of your theme folder:

  1. In GitHub Desktop, click the Create a New Repository on your Local Drive… button or navigate to File > New Repository.
  2. In the Local Path field, select the wp-content/themes/ folder in your Studio site (the path will look something like this: /Users/user_name/Studio/site_name/wp-content/themes).
  3. In the Repository Name field, type the name of the theme you’re developing. It should match the name of the theme in your wp-content/themes/ folder.
  4. Click Create Repository.

Once you click the Create Repository button, you will have created a local repository. Two hidden files will be added to your individual theme folder (.git and .gitattributes). 

To publish your local repository to GitHub:

  1. Go to GitHub Desktop and click the Publish repository button.
  2. Name your public repository; you can give it any name. You can also select whether you want your code to be public or private using the checkbox provided. 
  3. Click Publish Repository.

Once published, you should be able to see your repository with your theme code on GitHub.

If You’re Working on a Plugin

First, you’ll need to create a local repository inside of your plugin folder:

  1. In GitHub Desktop, click the Create a New Repository on your Local Drive… button or navigate to File > New Repository.
  2. In the Local Path field, select the wp-content/plugins/ folder in your Studio site (the path will look something like this: /Users/user_name/Studio/site_name/wp-content/plugins).
  3. In the Repository Name field, type the name of the plugin you’re developing. It should match the name of the plugin in your wp-content/plugins/ folder.
  4. Click Create Repository.

Once you click the Create Repository button, you will have created a local repository. Two hidden files will be added to your individual theme folder (.git and .gitattributes). 

To publish your local repository to GitHub:

  1. Go to GitHub Desktop and click the Publish Repository button.
  2. Name your public repository; you can give it any name. You can also select whether you want your code to be public or private using the checkbox provided.
  3. Click Publish Repository.

Once published, you should be able to see your repository with your plugin code on GitHub.

If You’re Looking to Sync All wp-content Files

If you’re not working on a specific plugin or theme and want to place a full site under version control, we recommend only tracking what’s inside the wp-content folder. This is where all your customizations are stored that make your site unique. The majority of WordPress core files usually remain unchanged and can be re-downloaded if necessary. The wp-config.php file is an exception, as it contains essential configuration details, primarily for your database connection.

If you want to sync the full website, including the database, consider using Studio Sync. While version control is not provided by Studio Sync itself, you can use this feature alongside GitHub-based development workflows.

First, you’ll need to create a local repository in your site wp-content folder:

  1. In Studio, select your site and click on the Overview tab.
  2. Click on Open in… Finder.
  3. Create a file named .gitignore inside the wp-content folder.
  4. Add the following folder and file names to this new .gitignore file to avoid tracking them in your repository. This will exclude the plugins required by Studio, your SQLite database, and your uploads folder. For this reason your posts, pages and images from your local site won’t be committed to your production site.
mu-plugins
database
db.php
uploads
  1. In GitHub Desktop, click the Create a New Repository on your Local Drive… button or navigate to File > New Repository.
  2. In the Local Path field, select the folder of your Studio site (the path will look something like this: /Users/user_name/Studio/site_name).
  3. In the Repository Name field, type wp-content, to match the name of your wp-content folder.
  4. Click Create Repository.

Once you click the Create Repository button, you will have created a local repository. Two hidden files will be added to your individual theme folder (.git and .gitattributes). 

To publish your local repository to GitHub:

  1. Go to GitHub Desktop and click the Publish Repository button.
  2. Name your public repository; you can give it any name. You can also select whether you want your code to be public or private using the checkbox provided. 
  3. Click Publish Repository.

Last updated: January 17, 2025