Deploying Your Git Repository to Shared Hosting: A Comedy of Errors and Triumphs

Manmeet Kaur Baxi
4 min readAug 5, 2024

--

The Problem Statement
Imagine this:
You’ve crafted the perfect website. It’s a digital masterpiece, a work of art in ones and zeros. But there’s a catch — you must deploy it to a shared hosting server. You’re armed with a GitHub account and a dream, but the path to deployment seems more daunting than diving in the sea. Fear not, brave coder! This guide will lead you through the perilous journey of deploying your Git repository to shared hosting, sprinkled with a dash of humour and a few plot twists along the way.

The Prerequisites: Buckle Up, Buttercup
Before we embark on this adventure, let’s make sure you’ve got your gear ready:
1. A Domain and a Server: Any hosting plan will do. Think of it as your home base, where your digital baby will live.
2. A GitHub Account: This is where your code resides, patiently waiting for its moment to shine on the big stage.
Alright, adventurer, let’s dive into the deployment process with Hostinger as our trusty steed.

Step 1: The Code Conundrum
First, ensure your website’s code is up-to-date on GitHub. This is your website’s version of a fresh haircut before a big date. You want it to look its best, don’t you?

Step 2: The Hostinger Hustle
Log in to your Hostinger account and click that shiny “Manage” button next to your web hosting plan. It’s like the red button in all the movies, but instead of launching missiles, it launches your website.

Step 3: The Dashboard Dilemma
You’ll be redirected to the dashboard, which is essentially your mission control. On the left, you’ll see the name of your website. Select the one you want to deploy using Git. If you have multiple websites, try not to panic. It’s like picking your favourite ice cream— but digitally.

Step 4: The FileManager Frenzy
Next, click on the “FileManager” section. This will take you to Hostinger’s HPanel. Find the “public_html” folder and open it. If it’s your first time deploying a website, this folder will be emptier than a cat’s food bowl at 5 AM. If you’re replacing an existing site, back up the old files. You never know when you’ll need them, like that high school yearbook photo you secretly love.

Note: The install path directory must be empty. No files, no folders, no problem.

Step 5: The Advanced Adventure
Back to the dashboard! Click on “Advanced” on the left side of the screen. From the dropdown menu, select “Git.” This is where the real magic happens.

Step 6: The SSH Key Kerfuffle
Open the Git page, copy the SSH key, and add it to your GitHub account. Yes, even if you’re deploying a public repository. It’s like adding a secret handshake to your club — it makes everything more secure and cool.

Step 7: The Repository Riddle
Head over to your GitHub repository and copy the HTTPS or SSH link. Here’s the cheat sheet:
- Public repositories: `https://github.com/manmeetkaurbaxi/portfolio.git`
- Private repositories: `git@github.com:manmeetkaurbaxi/portfolio.git`

Step 8: The Pasting Predicament
Paste the repository link into the Repository field, specify the branch name, and leave the Directory field blank. Remember to delete or empty the public_html folder, as we discussed earlier. Click “Create” and brace yourself for greatness.

Step 9: The Button Bonanza
You’ll see four buttons:
- Deploy: Launch your site.
- Continuous Deployment: Auto-deploy with each commit.
- Latest Build: Check the latest build output.
- Delete: Remove the repository.

Step 10: The Deployment Drama
Select the branch, enter the directory name, and click “Deploy.” For automatic updates with each GitHub push, select “Continuous Deployment.” Follow the instructions to add the webhook URL to your GitHub repository.

The Impact: A Digital Masterpiece
With each push to GitHub, your website updates automatically, saving you time and effort. It’s like having a magical butler for your digital presence. So sit back, relax, and enjoy the glory of a flawlessly deployed website. Your masterpiece is live (Here’s mine), and the world can bask in its brilliance.

And remember, even the most daunting tasks can be tackled with a bit of humour and a solid game plan. Happy deploying! 🚀

--

--

Manmeet Kaur Baxi
Manmeet Kaur Baxi

Written by Manmeet Kaur Baxi

Tech professional with over 4 years of diverse experience in finance, data science, software engineering, and academia.

No responses yet