WordPress GitHub Integration

by | Apr 7, 2023 | Etcetera | 0 comments

Fashion control has changed the best way wherein we assemble instrument. It’s an actual instrument that lets us keep track of the changes made during the development of a mission, and its usage has moreover extended to low-code platforms like WordPress.

In this article, we’ll dive into the usage of GitHub to extend awesome WordPress internet sites. You’ll find out about Git, the relation between it and GitHub, best practices, and practice a step-by-step knowledge on the usage of GitHub and WordPress.

Let’s get began with the basics.

What Is Fashion Control and Why Is It So Vital?

In the event you occur to don’t have previous experience with coding, the tips of version control, Git, and GitHub would in all probability seem relatively strange to you. First, let’s define each and every one in easy English.

Fashion Control

Fashion control is the process of tracking and managing all the changes in a mission. It lets you analysis, review, and even revert the entire mission to a previous state.

Any crucial internet construction mission should use version control instrument (and now you’ll use it on WordPress tasks too).
Know about Git, the relation between it and GitHub, & take a look at a step by step information on the use of GitHub and WordPress, all on this information 💪⬇Click on to Tweet


Git is by way of a long way necessarily probably the most used version control instrument available in the market. It’s an efficient instrument that comes with all the choices you want to artwork collaboratively, prepare the history of your mission, and correct mistakes if sought after.

With Git, the entire thing is recorded, so whilst you’ve saved a metamorphosis in a dedicate, you’ll take a look at the former, and are to be had once more to that vary. You’ll have the ability to bring to mind it as a limiteless “undo” movement, in order that you’ll certainly not lose the remaining.


GitHub, alternatively, is a similar but other software. It’s a internet hosting platform that stores Git repositories and lets you collaborate with other people all over the place within the globe. GitHub is this kind of hugely used instrument that many WordPress developers store their plugins and topic issues there, and a lot more impressive, the WordPress mission uses GitHub to artwork on open-source tasks similar to the Gutenberg editor.

In reality, there are other Git internet hosting platforms like GitLab or BitBucket, on the other hand we’ll be focusing on GitHub during this article.

The GitHub homepage, showing an illustration of a child in an astronaut costume in front of a large globe with glowing lines connecting country to country. The featured text reads "Where the world builds software".

Git and GitHub are apparatus that every developer needs. Whether or not or no longer you’re a backend, frontend, or WordPress developer, being skilled with the ones apparatus represents a huge get advantages inside the day-to-day building of a mission.

Benefits of Integrating GitHub With WordPress

There are many benefits of the usage of GitHub for WordPress building. Starting with the most obvious one; it allows us to incorporate the usual workflow of a Git venture into the development of a plugin or theme.

It implies that you’ll as a developer lift your typical workflow for each and every different web mission into WordPress building. In the event you occur to already know the way to use the instrument and in point of fact really feel at ease while the usage of it, it might be great to incorporate it while customizing your WordPress web page.

Merely imagine with the ability to benefit from the version control choices, like rolling once more to the version previous to the trade that messed up your web page, or the usage of Git branches to artwork and try on that crazy idea that you simply were given right here up with inside a coding afternoon.

You need to keep in mind that after all, WordPress is a selection of information basically written in PHP (a easy text format), so that you’ll use Git and GitHub to store and prepare the atomic changes made within the ones knowledge.

Development a WordPress mission collaboratively is another tricky reasons why for the usage of WordPress and GitHub together. You and your body of workers can artwork on different choices at the equivalent web page without threatening to take your production web page down.

In the event you’re carried out you’ll merely pull up the newest changes from main, or use any type of magic pull button from your Kinsta dashboard (keep finding out).

To sum up some great benefits of the GitHub and WordPress aggregate:

  • Signifies that you’ll use your usual workflow in WordPress building
  • Can prevent your web page from happening after an error in some PHP document by way of rolling once more to the previous version
  • It implies that you’ll collaborate at the same time as on the choices of your web page.

Getting Started With Git, GitHub, and WordPress

In this section, you’re going to learn how to assemble a plugin or theme the usage of GitHub and WordPress.

Forward of starting, let’s grab the main idea of this process. You’re going to start a local Git mission, where you’re going to build the main permutations of your plugin/theme — we discuss them since they’re necessarily probably the most typically edited knowledge in a WordPress mission — then you definitely definately’ll create a GitHub repository and clone it inside your WordPress reside arrange.

Let’s get into it!

Step 1: Arrange Git on Your Computer

This may occasionally seem just a little bit evident, on the other hand you want to have Git installed on your device previous than you get began operating on your plugin or theme.

To place in Git merely go to the authentic downloads web page and select up the suited package deal for your operating instrument.

See also  Web3 and WordPress: What to Be expecting From the Long term (+Plugins)
The official Git downloads page showing the macOS, Windows, and Linux download methods for the Git installer and the current version "2.34.1".
Git downloads

In the event you occur to’re operating macOS or Linux, it’s conceivable you’ll wish to run a command in a terminal, whilst must you employ House home windows, you’ll have to fan the flames of the wizard installer which is in a position to take up to a few minutes.

To verify Git is installed, run the following command in a terminal or command prompt:

git --version
# git version "your version"

Step 2: Sign Up on GitHub and Create a Repository

Create or log in to a GitHub account by way of visiting GitHub’s sign-up web page.

GitHub Sign Up page with the fields of email, password, and username.
GitHub Sign Up internet web page.

After signing in, create a repository for your plugin or theme by way of going to the new repository hyperlink.

GitHub new repo page with the fields Owner, Repository name, Description, Accessibility, README, and license files.
GitHub new repository

Fill the repository name, with the decision of the plugin you’re going to build, in my case: MyWordPressTheme, add an summary with a quick analysis of your mission, choose whether or not or no longer your repo is going to be public or private (public: anyone can view it and fork it, private: most simple you’ll get admission to it), decide if you want to include a README and a license from the start, and click on on on Create repository.

Step 3: Set Up Your Local WordPress Environment

Now, you want to organize your local WordPress atmosphere. Now we have now a whole article on how you can set up WordPress in the community, so use the most suitable option in step with your operating instrument.

You’ll have the ability to prepare a local WordPress setting the use of XAMPP, on the other hand we recommend the usage of DevKinsta, a free local WordPress building suite available in House home windows, Linux, and macOS.

Let’s see how we will do this the usage of DevKinsta.

First, download the best DevKinsta version for your operating instrument from our obtain web page. Then run the arrange wizard, this should take a few minutes. For more information take a look at our knowledge base on putting in DevKinsta.

Then create a website from the main menu. We’re going to use the “New WordPress web page” chance.

DevKinsta create New WordPress site with NGINX, MySql, and WordPress 5.8 option.

Now, enter your web page name, WordPress admin username, and password. Click on on on the Create web page button.

MyKinsta new WordPress site form with the fields of "Site name", "WordPress admin username", and "WordPress admin password" as well as the create site button.
New web page.

This will likely from time to time mechanically create a WordPress web page inside the folder /space/username/DevKinsta/public/site-name, you’ll open it by way of clicking on the “web page path” section.

Site info showing the path to the site WordPress files.
Web page information.

You’ll be in a position to take a look at the WordPress document building in a document manager.

File manager showing the file structure of the site you just created, including some important files like the "wp-config.php" and the "index.php" files, as well as the subfolders "wp-content", "wp-includes", and "wp-admin".
WordPress document building.

Now you’ve an absolutely useful WordPress web page in your home record.

Step 4: Clone the GitHub Repo Into Your Local Instrument

It is advisable have a some distance flung GitHub repository with the README and license knowledge, it’s time to hold them into your local atmosphere and get began rising the theme.

In this example, we’re construction a theme, on the other hand you’ll do the exact same process creating a plugin.

Cross on your WordPress web page’s folder and enter the wp-content record, which comprises all the plugins and topic issues available.

After growing the web page with DevKinsta, you want to enter the web page path available inside the Web page Knowledge and go to the wp-content folder.

In the event you occur to created your web page the usage of XAMPP, you’ll enter the /make a decision/lampp/htdocs/web page/wp-content folder on Linux, and macOS, whilst on House home windows you merely wish to go to the folder in which you extracted the WordPress provide code.

Then, as we’re construction a theme, we go to the topics folder and clone the repository we created on GitHub. Bear in mind to organize your SSH keys on GitHub if you happen to occur to’ve no longer carried out it.

Right here’s this complete process with a few directions:

cd /space/username/DevKinsta/public/site-name/wp-content/topic issues # or your wordpress web page location
git clone git@github.com:YourUsername/mywordpresstheme.git
cd mywordpresstheme/

Now you’ll in truth get began operating on your WordPress theme or plugin.

Step 5: Add, Devote, and Push Changes to Your Remote Repo

It’s time to build your theme.

One of the most advantages of setting up a theme or plugin on your local device is that you simply’ll mess around, use the apparatus, make all the changes, and try all the ways you want. So go ahead and create the most productive plugin or theme you’ll.

Alternatively, must you’re no longer relatively accustomed to the process of constructing a WordPress theme from scratch, listed below are some knowledge you’ll have to take into accout.

  • index.php: The main document of the theme building (required)
  • varieties.css: Defines the style of the web page, the usage of CSS language (required)
  • front-page.php: Creates the main view of the web page; the / (root) internet web page
  • footer.php: Defines the footer of the web page, and it’s used in a number of the web page pages
  • functions.php: Shall we in to generate custom designed capacity
  • header.php: Defines the header
  • 404.php: Defines the “404 error” view
  • internet web page.php: Pages generated by way of the admins’ web page
  • screenshot.png: Image used as a logo of the theme
  • single.php: Default view used for posts.

For added instructions, you’ll take a look at with the WordPress developer’s internet web page on Theme Building.

In the event you’ve complex your theme it’s time so that you can upload and commit all the changes to GitHub.

First of all, run git status to seem exactly what changed.

git status
Untracked knowledge:
(use "git add ..." to include in what's going to be devoted)
internet web page.php

Now, add all the knowledge inside the provide record and commit them.

git add ./
git commit -m "Added theme knowledge"

In spite of everything, push the entire ones changes to the some distance flung repo on GitHub.

git push

Step 6: SSH Into Your WordPress Web page and Clone the Repo

You’ve built the theme, it’s time to use it to your reside WordPress web page.

See also  Divi Plugin Highlight: Divi WooCommerce Extended

To do this you want to hook up with WordPress the use of SSH. This lets you interact with the server your WordPress web page is located and clone the repository of your theme.

Most internet hosting services and products offer a way to use SSH, for more information seek advice from your provider’s documentation.

We’re going to use Kinsta’s SSH characteristic on the other hand believe you’ll be capable to do this with other internet hosting services and products.

First, get your SSH command and password.

MyKinsta dashboard of the site "Test with WordPress" showing the password and SSH terminal command fields.
MyKinsta web page dashboard.

Paste your SSH command proper right into a terminal or command prompt, and input the password (the usage of Kinsta you’ll wish to authenticate to copy the SSH password).

In the event you occur to authenticated correctly you’re now within your WordPress web page document building.

Terminal connected via SSH to a Kinsta site.
Kinsta SSH.

Now, you’ll wish to navigate on your web page’s folder, which is typically located on /www/name-site/public/. From there you’ll go to the topics folder and clone your repo into it.

cd /www/name-site/public/wp-content/topic issues

git clone https://github.com/yourusername/MyWordPressTheme.git

Understand we’re the usage of HTTP when cloning the GitHub repo since we won’t make any changes to the theme on the server. We’ll most simple create changes the usage of our favorite code editor in our local device and no longer in an unpleasant terminal editor on the server.

Any more, every time you want to pull the newest changes of the some distance flung repo into your server, you’ll simply run:

git pull
front-page.php | 2 +-
1 document changed, 1 insertion(+), 1 deletion(-)

Step 7: Enter the WordPress Admin Activate Your Theme

In the event you’ve downloaded the theme you built it’s time to modify on it on your reside WordPress web page. Log in on your WordPress admin dashboard typically located at:


Then, go on your Glance section and turn to your awesome theme.

WordPress admin dashboard with an arrow pointing to the "Activate" theme button.
Select your theme.

In the event you occur to’re operating with plugins you’ll do the equivalent process, except for for placing your plugin during the /wp-content/plugins folder.

Congratulations — you’ve merely built a WordPress theme the usage of Git, GitHub, and WordPress!

The usage of MyKinsta To Mix GitHub With WordPress

To make WordPress developers’ lives more uncomplicated, we’re launching GitHub Deployment for WordPress. GitHub Deployment connects on your GitHub account and lets you take pleasure in the method of rising your web page locally while allowing you to push it to reside with one click on on.

The only issue you want is a MyKinsta account and the power to use version control for WordPress building.

Advantages of The usage of GitHub Deployment

Listed below are the very best advantages of this process:

  1. Merges the experience of rising locally and deploying remotely to WordPress
  2. Signifies that you’ll use all the choices of version control with Git and GitHub
  3. Simpler than the manual means confirmed above
  4. Auto-deploy changes from your GitHub repo

For now, you’ll most simple use this feature in staging environments, on the other hand we’ll see how you’ll push all the changes on your reside web page.

Moreover, you must download WordPress core knowledge, and commit them on your repo. You’ll have the ability to’t merely commit a theme or a plugin, since upon deployment all staging knowledge are removed.

With that being said, the process is way more easy than you want to think.

Let’s see the way you’ll mix GitHub with WordPress the usage of MyKinsta!

Step 1: Create a GitHub Repo With All of the WordPress Core Knowledge

This is similar to the method used above, except for you’ll wish to commit all the knowledge of the WordPress arrange on your GitHub repo.

First, create a repo on GitHub and clone it on your device so that you’ll get began construction the web page to your local atmosphere.

git clone git@github.com:youusername/WordPress-site.git # After you created the repo on GitHub

Then obtain WordPress’ supply code and unzip its contents (knowledge inside the wordpress/ folder) during the repository you merely cloned. You’ll have the ability to do it manually the usage of a graphic document manager or run the following directions:

unzip path/to/wordpress/zip
cp -a wordpress/. path/to/your/repo/

Understand how we’re extracting the zip document into the prevailing record and then copying the contents of it into our repo the usage of the precise cp dot (/.) syntax.

Now, the development of your repo should look reasonably like this:

├── .git
├── wp-admin
├── wp-content
├── wp-includes
├── .gitignore
├── index.php
├── license.txt
├── readme.html
├── README.md
├── wp-activate.php
├── wp-settings.php
├── wp-signup.php
├── wp-trackback.php
└── xmlrpc.ph

Regulate your mission, whilst you’re carried out commit all the changes to the GitHub repo:

git add ./
git commit -m "Added WordPress knowledge"

This section is where you’ll have to invest additional of your time. You’ll see how simple it’s to mix GitHub with WordPress.

Step 2: Create or Use a Web page on Your MyKinsta Dashboard

If you already have a web page you’ll skip this step, on the other hand In the event you occur to’re going to create a brand spanking new web page, it’s upper as well as up an empty atmosphere. It’ll take a lot much less time than a whole WordPress arrange.

Cross on your MyKinsta dashboard, click on on on the Internet sites section, then snap the Add web page button. Fill inside the wisdom and inside a couple of minutes, you’ll have an empty atmosphere to artwork with.

See also  Create a Useful resource-Pleasant Browser (The usage of Opera)
Add site modal with the
Add web page modal.

Step 3: Industry To a Staging Environment

As mentioned earlier, this feature is most simple available in staging environments.

To create a staging atmosphere go on your web page’s dashboard click on on on the Environment selector located on the most productive of the internet web page, and choose Staging from the drop-down menu.

Kinsta's site page staging environment option.
Staging atmosphere.

Now, click on on on the Create a staging atmosphere button. Depending on the choice of knowledge you’ve to your reside atmosphere, it’ll take kind of time as well as up. That’s why it’s in point of fact useful to create an empty atmosphere must you don’t have a reside web page to start with.

Create a staging environment page with the title "My awesome Kinsta site", instructions about this feature, and an arrow pointing to the "Create a staging environment" button.
Create a staging atmosphere.

In the event you’ve deployed your repo to the staging atmosphere you’ll push it to the reside atmosphere. We’ll see this in movement in a while.

Step 4: Connect To GitHub

To drag a repository from GitHub, MyKinsta needs get admission to on your GitHub account. Don’t concern — this happens with every supplier that wants permissions to a selected repo.

Cross to the Deployment section available whilst you’ve created your staging atmosphere, and click on on on the Get started setup button.

GitHub Deployment page in MyKinsta, showing the "Begin setup" button.
Get started setup.

Now, you’ll be redirected to GitHub’s authentication internet web page, so that you’ll configure the deployment of your GitHub repo.

As quickly because it’s carried out, you’ll make a selection the Team (typically your personal account) you want to pull your repo from, the Repository in which you complex your WordPress web page, and the dep. you want to pull from (normally, it’s “main”).

Configure deployment modal with the checked "Auto deploy" option.
Configure deployment.

You’ll have the ability to take a look at the Auto deploy on commit box if you want to have MyKinsta to deploy every trade you made to the dep. you made a decision on.

Be careful with this option, you most simple wish to auto-deploy when you’re operating in a selected division for each and every feature and in addition you’re most simple committing to the main division when merging those choices.

Click on on on the Finish button. Now, you’ll deploy your repo into your Staging atmosphere.

 GitHub deployment page of the "My awesome Kinsta Site" showing the "Deploy now" button.
Deploy now.

It won’t take more than a couple of seconds so as to revel for your new staging web page. You’ll have the ability to seek advice from it by way of going on your Domains section and then clicking on the Open URL link.

"My Awesome Kinsta Site" Domains section showing the Open URL link.
Open URL.

If for some reasons why you want to disconnect your MyKinsta web page from your repo, go to the Industry settings chance and click on on on the Disconnect button.

Deployment modal showing the "Organization", "Repository", and "Branch to pull" fields, the auto-deploy checkbox, and the "Disconnect", "Cancel", and "Change deployment" buttons.
Disconnect repo.

Step 5: Push to Are living

In the event you’ve moderately tested that the entire thing is working as it should be, you’ll push your staging setting to are living.

Click on on on Environmental actions and choose the Push to reside chance.

GitHub Deployment section showing the "Push to live" environmental action.
Push to reside.

In the event you occur to’ve made it this a long way, you’ll have to now have a totally useful web page deployed from a GitHub repository!

GitHub Deployment Tips

You’ll have the ability to benefit from this feature in numerous ways, so listed below are some key tips to use it effectively:

  1. Use all the local apparatus you’ll’t use in a some distance flung atmosphere like an SSH session. This involves the usage of code editors like VS Code, or a complete building suite like DevKinsta.
  2. Arrange your GitHub mission the usage of branches, and most simple commit changes to main when merging a division.
  3. Absolute best transfer at the auto-deploy chance must you practice the second tip.
  4. Test the entire thing! Don’t let that bug reach the producing web page.
  5. Be careful with the tips you edit, extra continuously than no longer you’ll wish to make changes during the wp-content/ folder.

Able to be informed how WordPress + GitHub can take your website construction up a notch?👩‍💻 Learn on… ⬇Click on to Tweet


Git and GitHub are in reality tricky apparatus for every developer available in the market. Now you know how to mix them with WordPress.

You’ll have the ability to use every the SSH means and the new MyKinsta feature: GitHub deployment. Each of them has its non-public advantages:

  1. SSH means: Absolute best works with topic issues and plugins. You manually create a repo, assemble a theme or plugin and pull it from the server your web page is hosted in.
  2. GitHub Deployment means: This is a new feature for MyKinsta. This is an automated process in which you’ll point of interest on construction your web page locally, Kinsta handles the deployment stuff.

You’ll want to overview them and create the most productive WordPress web page you’ll.

In the event you occur to’re new to WordPress building and felt just a little overwhelmed by way of this data, concern no longer. This isn’t a race, on the other hand a marathon, and the first step is to be told the fundamentals of PHP and create a lot of exciting tasks.

How has integrating WordPress with GitHub affected your web page and your building process? Let us know inside the comments section!

The publish WordPress GitHub Integration appeared first on Kinsta®.

WP Hosting

[ continue ]

WordPress Maintenance Plans | WordPress Hosting

read more


Submit a Comment

Your email address will not be published. Required fields are marked *