# Deploy Jekyll Site Hosted on GitHub Pages to Azure
But why? If GitHub Pages (opens new window) is free, then why pay?
- You might want to push your site to a private repo (instead of public)
- Setting up "real" SSL, compared to the workarounds (opens new window) (see comments)
- Taking advantage of deployment slots (opens new window).
I'm sure there are more, but those are top of mind for me.
# Let's begin
I'm assuming you already have a GitHub Pages site that uses Jekyll hosted on GitHub. If that is true, then the first thing that you'll want to do is grab these three files.
- deploy.cmd (opens new window) - is a Kudu (opens new window) Deployment script that handles setup and deployment of the web site and ensures Ruby is installed
- getruby.cmd (opens new window) - is a site that ensure the latest version of Ruby is installed and ensures Jekyll has been built
- .deployment (opens new window) - is a configuration file that Kudu understands that calls the
- Gemfile (opens new window) - you probably already have this but ensure it is there and if not then just copy mine.
Thanks goes to Khalid Abuhakmeh (opens new window) for writing the scripts
Once you have these three files, ensure they are in the root of your public GitHub pages site (ex. something.github.io)
You'll want to go inside of your Azure Portal (or use the CLI tools) and create an App Service -> Web App. Once the site is deployed, then go to Deployment Options and select GitHub, your project and press OK.
You should see "Settup up Deployment Source..." in the notification windows. You'll probably want to wait a good 15 to 20 minutes for Azure to setup everything. You can stay on the Deployment Options blade and you should see the status of the deployment.
After a while you see a check mark that it completed successfully. Now you can navigate to the URL listed on the Overview blade.