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 WordPress 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 new theme
First, you’ll need to create a local repository inside of your theme folder:
- In GitHub Desktop, click the “Create a New Repository on your Local Drive…” button or navigate to File > New Repository.
- 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. - 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
). - 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
).
If you attempt to enter the details of a folder that is already configured as a Git repository, then GitHub desktop will prompt you to add this repository instead.
You can now create your theme inside this local repository.
To publish your local repository to GitHub:
- Go to GitHub Desktop and click the “Publish repository” button.
- If you aren’t already, you will be asked to sign into your GitHub account.
- Name your public repository; you can give it any name, but it’s a good idea to keep it the same name as the theme folder. You can also select whether you want your code to be public or private using the checkbox provided.
- 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 new plugin
First, you’ll need to create a local repository inside of your plugin folder:
- In GitHub Desktop, click the “Create a New Repository on your Local Drive…” button or navigate to File > New Repository.
- 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. - 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
). - 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
).
If you attempt to enter the details of a folder that is already configured as a Git repository, then GitHub desktop will prompt you to add this repository instead.
To publish your local repository to GitHub:
- Go to GitHub Desktop and click the “Publish Repository” button.
- Name your public repository; you can give it any name, but it’s a good idea to keep it the same name as the theme folder. You can also select whether you want your code to be public or private using the checkbox provided.
- Click “Publish Repository“.
Once published, you should be able to see your repository with your plugin code on GitHub.
If you want 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:
- In WordPress Studio, select your site and click on the Overview tab.
- Under the “Open in…“ section, open the site folder in your chosen code editor.
- Create a file named
.gitignore
inside thewp-content
folder. - 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
- In GitHub Desktop, click the “Create a New Repository on your Local Drive…” button or navigate to File > New Repository.
- In the “Repository Name” field, type
wp-content
, to match the name of yourwp-content
folder. - 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
). - 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:
- Go to GitHub Desktop and click the “Publish Repository” button.
- 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.
- Click “Publish Repository“.
Last updated: July 17, 2025