How To Install WordPress With Git

This tutorial will show you how to install a new WordPress site using Amezmo. All code will live in your Github repository, so all references to the command line will be executed from your local machine. For this tutorial, you’ll need to create a new application from the Dashboard. Check out the docs for more information on how to do this.

Step 1

Download the latest WordPress version from WordPress.org. Make sure to download the .zip version (the default).

Step 2

Fire up a terminal on your local machine, and type the following commands. Note: You may need to change ~/Downloads to the location where you’ve saved your WordPress *.zip file. As of this tutorial, the latest WordPress version is 5.2.1, so the file name is wordpress-5.2.1.zip


mkdir Blog
cd Blog
cp ~/Downloads/wordpress-5.2.1.zip .
unzip latest.zip
cd wordpress
cp wp-config-sample.php wp-config.php
curl -s https://api.wordpress.org/secret-key/1.1/salt/

After running the curl command, you should see the following. It won’t be exactly as I show here because the values are randomly generated.

Next, copy the output of the curl above, and then open up wp-config.php.. In this file, you should see the following. Make sure to replace the defines shown below, with defines you’ve copied to your clipboard above

While wp-config.php is open, replace ‘password_hereo’ with the password you provided on the Create an application form. Learn more about database passwords on Amezmo by checking out the docs.

Now that you’ve configured WordPress, it’s time to initialize your Git repository, and then push to GitHub. Make sure you’ve created a new empty repository on GitHub before running these commands. From the Blog directory you created earlier, type the following commands.


git init .
git add .
git commit -m 'First commit'
git push -u origin [email protected]:<GITHUB USERNAME>@<repo name>

So after you’ve pushed your code, the last step is to import your repository. Follow the directions in the Amezmo documentation, and you’ll be done. After importing your repository, navigate to the private domain name Amezmo provides you, and finish setting up your WordPress username and password. You can see the private domain name from the Overview tab in your Dashboard.