For example, the first release of WordPress was in 2003, while the first release of Git took place in 2005. Of course, there were capable version control systems long before Git, but considering the widespread use of Git in the industry today, this may serve to put WordPress in its proper context. WordPress + Git = ♡. VersionPress is a free and open-source plugin that brings the full power of Git to WordPress. Its key strength is that it version-controls not just. Git Workflow Edit. This documentation is intended to help you get started using git with Gutenberg. Git is a powerful source code management tool; to learn git deeply, check out the Pro Git book available free online under CC BY-NC-SA 3.0 license. If you are unfamiliar with using git, it. Using Git with WordPress — Part 2 Building High-Quality Web Apps. The methodology consists of twelve recommendations on how best to handle such concerns. In this article, the approach we've settled on is to disable plugin and theme installations from the. Syncing Git Repositories with WordPress So, you like this idea of developing websites or testing changes for your website in a better environment and you also like the idea of a Git host managing the storage and version control of your project.
Making changes to a live website can be one of the most nerve-racking moments for an administrator. One can never predict when some unknowable factor in is going to play a role and screw up your installation. Whether it is a configuration change, a new plug-in, a new theme, or something else, website administrators have to take a lot of care to always have a backup available to them. But in a professional setting, this is not sustainable particularly if you have more than one person maintaining the code base. I can speak from personal experience that my application development was revolutionized when I started using versioning systems. No longer do you worry about accidentally screwing something up because it’s so easy to revert back to any version in the past.
I’ve often wanted to implement a version control system like git onto WordPress, but haven’t really gotten around to it. I would have to set up my own git server and all that. However, when I moved to SiteGround I was pleasantly surprised to see that they offer git for WordPress right out of the box! It’s as simple as clicking a button to create a repository. The only difficulty I had was in cloning it to my desktop computer – and I finally managed to figure it out. Doing all your development on a local machine and then pushing the changes to a live server has the advantage of knowing that nothing short of database corruption poses a real threat to your site. Everything else can be reversed.
So let’s see how to enable git on SiteGround and how to clone our first repository.
When you log into your SiteGround cPanel, navigate down to the icon called “SG-Git” as shown here.
If you set up your WordPress installation properly and have had it recognized by SiteGround, you should see it in the list at the bottom of the next screen. Under the “Actions” heading, you will have a button called “Create Git Repository”.
This will bring up a lightbox informing you that native WordPress updates might be impacted, but I don’t really see how that can happen. SiteGround informs you that even if this is the case, the auto update tool from within the SiteGround account will be able to update the installation. Worst-case scenario, I can always delete the git repository, update WordPress, and create it again.
In any case, I’m excited to try out this functionality so I’m willing to take the risk! Once you click the “Continue” button on the lightbox, SiteGround will show you a pop-up with two important pieces of information:
If you’ve already created one or more SSH keys to access your SiteGround account as shown in my earlier tutorial, the first piece of information will simply be one of them. We’ll see how to use the second in a moment.
If you haven’t already, download and install the standard Git installation for Windows. Now as in the tutorial I showed earlier, download puttygen.exe after having copied and pasted the SSH key from the previous screen into a blank notepad file with the extension “ppk”. If you’ve set up SSH access earlier, then you already have the PPK file ready to go.
Fire up puttygen.exe, click “Load” and select the PPK file as shown below. Then go to “Conversions”, click “Export OpenSSH Key” and save the file in your “.ssh” directory of your git installation. In this example, I’ve chosen to call the exported OpenSSH key “wordpress_git”. You can make out that it’s the right directory because the other files in it will look like this:
The next step is to add the SSH key with the “ssh-add” command. Simply type in:
Or whatever you’ve named your key. Enter the passphrase for your key and git will add your identity as shown in the screenshot below:
Now that you’ve imported your key into git, you can use the clone command displayed when you first created the git repository like this:
This should clone your remote WordPress installation into your local directory – let me tell you, it’s a good feeling when it works out! And just to verify that this is indeed what happened, here’s a screenshot of my WordPress files in my local PC folder:
Pretty neat huh? This is not the place where I go into the details of how to stage and push changes using git. That’s a different tutorial altogether, but you can see for yourself how simple it is to set up a git repository on WordPress and clone it using the SiteGround tools.