- In the tech world, GitHub has become one of the most important tools available to all the managers, programmers and other allied professionals. GitHub, in its literal sense, is the largest host of source-code all over the world with over millions of users presently contributing to more than six million of its repositories. Whether you are looking for the next gig or simply trying to stay pertinent with a number of frameworks, GitHub is an imperative launching pad for your WordPress site.
But, the question now arises is How can we better work on WordPress with GitHub? Fret not, keep scrolling and reading, you will get the answer!
For Setting Up The Local And Remote Sites With Git
- Step #1: Make A Local Site Few clicks and you can easily create a local WordPress site with DesktopServer! Before anything else, create a few of blueprints, which will be used by the DesktopServer to build the site. Check out the DesktopServer application folder where they are stored in the blueprint directory. Now, open the DesktopServer and let your web severer get restarted and then select the option named Create a new development website.
And then, give a name to your site that will be the address along with the bogus top-level domain .dev attached to it. To create the site, click on Create, the time you are done with your settings.
- Step #2: Make A Local Git Repository To put the WordPress site under the version control, click the New/Clone option from the menu in the Source Tree. Now, a window will appear, select New Repository from here, select Git for Repository Type and look out for the root level of the new developed site from the Destination Path field.
Once you are done with it, in the bookmarks section, you will see a new repository. Open it up now! Tell the git to ignore the wp-config file and manage the varied wp-config files for the different servers. Or, click Files In The Working Tree list and selecting Ignore.
Positioning The Live Sites
- Step #1: Deploy Your Site From The Bitbucket Instead of pushing your site from your personal computer directly to your remote site, deploy the site from the Bitbucket this time. It will spare you from creating SSH keys on the remote site plus this automatically creates a backup of all the files.
From the inside of SourceTree, you can easily create repositories in your Bitbucket or GitHub account. Simply go back to the repository and select the option that says Add Remote.
- Step #2: Organize The Remote Server Three will be a requirement of creating a database, wp-config file and directory in the remote server. To create the database manually, bring out a copy of your local wp-config file, alter all the details of the database, the contestant for live uses like WP_DEBUG, upload the same with an FTP client one level above the WordPress root directory.
This is how WordPress will be finding the wp-config file automatically and hence, no surplus setup is required to be made. This is more likely to help in enhancing the security of your site.
- Step #3: Now, Its Time To Sync Database Congratulations, now you are having a WordPress site on your remote site along with the WordPress files having a completely different database. And, here comes in the WP Migrate DB Pro. Make sure that you have installed WP Migrate DB Pro on both the local sites and the remote one. Plus, also ensure that you have activated the API key in both sites as well.
In the settings section of the WP Migrate Pro, select Accept push requests allow this database to be overwritten and then copy the entire content of Connection Info. After doing that, move onto the local site and select Accept pull requests allow this database to be exported and downloaded. Next step is to select push by going under the Migrate tab so as to enter the connection info for the remote site. Click on Connect and there you go!
This is how you all can manage the WordPress workflow with the GitHub. The version control systems such as Git have helped so many developers all over the years permitting the association on a level that was not the case previously. It is not always easy to get started with such versions and moreover if you are working with established project like WordPress Development. Try doing things the way discussed in this article; I hope this going to help you!