Create a Repository From an Existing Source
To set up Deployments on WordPress.com, you first need to create a repository using your local source files. This guide will walk you through the process. It assumes you already have a account and Git installed on your computer.
Create a local Git repository
If you already have a local Git repository, you can skip this step and go directly to the Adding your files to section.
For those who need to create a local Git repository, the following guides will walk you through the process using the terminal. If you prefer a visual interface, consider using Desktop instead.
Studio by WordPress.com projects
Sites created with Studio include a full WordPress installation. While you can add all of these files to , it’s recommended to create the repository for only the files you need to keep version controlled. This is typically the wp-content
folder or individual plugins and themes.
Let’s assume you have created a new theme and plugin in your Studio project. Your project file structure should look something like one of the following:
site-folder/...
site-folder/wp-content/...
site-folder/wp-content/themes/mytheme
site-folder/wp-content/plugins/myplugin
- In Studio, select your local site and click “Open in Terminal“. The current working directory will be your site folder.
- Run
cd wp-content
. - Run
git init
to create your Git repository. (If you want to create a repository for a single plugin or theme,cd
into that directory before runninggit init
). - Next, run
git add themes/mytheme plugins/myplugin
to tell Git to track your files. You can also rungit add .
to track all files in the current directory. - Finally, run
git commit -m "Initial commit"
.
You can now move on to Adding your files to .
Local by WP Engine® projects
Like Studio, sites created with Local include a full WordPress installation. While you can add all of these files to , it’s recommended to create the repository for only the files you need to keep version controlled. This is typically the wp-content
folder or individual plugins and themes.
Let’s assume you have created a new theme and plugin in your Local project. Your project file structure should look something like one of the following:
public/...
public/wp-content/...
public/wp-content/themes/mytheme
public/wp-content/plugins/myplugin
- In Local, select the site you are working on and click “Open site shell“. The current working directory will be
public
, which is the site’s root folder. - Run
cd wp-content
. - Run
git init
to create your Git repository (If you want to create a repository for a single plugin or theme,cd
into that directory before runninggit init
). - Next, run
git add themes/mytheme plugins/myplugin
to tell Git to track your files. You can also rungit add .
to track all files in the current directory. - Finally, run
git commit -m "Initial commit"
.
You can now move on to Adding your files to .
wp-env projects
wp-env
is the official WordPress development environment based on Docker. This section assumes you have already set up a wp-env
project. If not, you can follow this guide to get started.
Let’s assume you’ve created a new theme and plugin. Your project file structure should look something like one of the following:
<project root>/wp-content/themes/mytheme
<project root>/wp-content/plugins/myplugin
or
<project root>/themes/mytheme
<project root>/plugins/myplugin
- Using
cd
, navigate to the<project root>
in your terminal. - Run
git init
to create your Git repository (If you want to create a repository for a single plugin or theme,cd
into that directory before runninggit init
). - Next, run
git add .
to tell Git to start tracking your files. - Then, run
git commit -m "Initial commit"
to commit your files.
You can now move on to Adding your files to .
Files on WordPress.com sites
The previous examples focused on adding local files to your repository, but what if the files currently exist on a WordPress.com site?
To add these files to , you can use the rsync
command to retrieve them from the server. Alternatively, you can copy the files to your local system using an FTP client.
To use the rsync
command:
- Go to
wordpress.com/hosting-config/:your-site
. - Under SFTP/SSH credentials, click “Create credentials” if you have not already done so.
- Enable SSH if it’s not already.

- Copy the SSH address (e.g.
[email protected]
). - Identify the path to the content you want to download:
- Each theme lives in its own folder under
/htdocs/wp-content/themes/
. - Each plugin lives in its own folder under
/htdocs/wp-content/plugins/
.
- Each theme lives in its own folder under
- Create a folder on your local machine by running
mkdir [PROJECT_NAME] && cd [PROJECT_NAME]
, where[PROJECT_NAME]
is the name of your project folder. - Download the theme or plugin from WordPress.com into your local project folder by running
rsync -avzh [SFTP_USERNAME]@sftp.wp.com:[PATH_TO_CONTENT_FOLDER] .
.[SFTP_USERNAME]
is your SFTP credential’s username.[PATH_TO_CONTENT_FOLDER]
is the absolute path to the content (theme or plugin) you want to download.
For example, let’s assume you have a custom theme “mytheme” on your WordPress.com site and wish to create a deployment for it. Your theme should be at /htdocs/wp-content/themes/mytheme/
, and that should be the path used in the command.
Note: It’s important to include the trailing /
after the theme name to ensure content inside the folder gets downloaded.
- You will then be prompted to enter your password, which can be found under SFTP credentials of your Server Settings at
wordpress.com/hosting-config/:your-site
. - Wait for the download to complete, and then navigate to your content folder by running
cd [CONTENT_FOLDER_NAME]
. - Then, run
git init
to create a Git repository. - Next, run
git add .
to tell Git to track your files. - Finally, run
git commit -m "Initial commit"
.
When running the rsync
command, it’s common to run into the following error:
receiving file list ... unexpected tag 103 [receiver]rsync error: error in rsync protocol data stream (code 12)
This often happens when the wrong path is supplied to the rsync
command, so make sure to check that the path is correct.
Add your files to
Before starting this step, ensure you have a local Git repository set up. We’ll create a repository on and push (upload) the contents of your local repository to it.
Before starting this step, ensure you have a local Git repository set up. Next, you’ll create a repository on and push (upload) the contents of your local repository to it.
If you prefer a more visual approach, you can use Desktop to create and push your repository instead.
Start by creating a new repository:
- Navigate to https://.com/new.
- Choose the Owner and a name for your repository.
- Add an optional description.
- Choose Public or Private. If private, you will need to generate an access token before pushing your local repository to .

- Leave all other options as default. You can add a README and license later.
- Click on the “Create Repository” button.
- Take note of your repository URL, which will be
https://.com/<account name>/<repository name>
. - Back at the root of your project, run
git remote add origin https://.com/<account name>/<repository name>.git
. This will link your local repository to your repository. Locally, your remote repository will be known asorigin
. - Next, run
git remote -v
to verify it worked. You should see something like:
origin https://.com/<account name>/<repository name> (fetch)
origin https://.com/<account name>/<repository name> (push)
- Now run
git status
and note the branch name you’re using. - Run
git push -u origin BRANCH
with the branch name from the previous step. - If your repository is public, there is nothing more you need to do. Skip to step 20.
- If your repository is private, you will be prompted for an access token. Create a new access token.
- Enter a value in the “Token name” field and choose an expiration date.
- Under “Repository access“, choose “Only select repositories” and select the repositories you want the token to be valid for.
- Under Permissions, expand “Repository permissions” and scroll down to Contents.
- Change the access to “Read and write“.
- Click “Generate token” at the bottom of the page.
- Copy the access token from into the command line when prompted.
- Check and confirm your local files are now in your repository.
For more information on setting up repositories, refer to the official documentation.
Now that you have an active repository and your local code is available online, you can move on to setting up a WordPress.com deployment.
Last updated: March 25, 2025