Documentation: deploying a Next.js application with GitHub + Hostinger
Every push becomes a live site with no hosting panel involved: connecting GitHub to Hostinger, the build settings that break and the checks after each deploy.
- deploy
- github

Contents
- 1. Overview: how the flow works
- 2. Prerequisites
- 3. Step 0: initial checks (in the terminal)
- 4. Step 1: preparing the project (in VS Code / the terminal)
- 5. Step 2: create the repository (on the GitHub site)
- 6. Step 3: send the code to GitHub (in the terminal)
- 7. Step 4: deploy on Hostinger (in the hPanel)
- 8. Step 5: automatic sync and the daily flow
- 9. Troubleshooting
- 10. Quick reference
- 11. Glossary
1. Overview: how the flow works
The goal of this setup is that every change to the code gets published to the site on its own, with no manual file upload. The flow is this:
Your computer (code) ──git push──> GitHub (stores the code) ──automatic deploy──> Hostinger (runs the site)- You edit the code on your computer (VS Code).
- You send the changes to GitHub with the
git pushcommand. - Hostinger detects the push on its own, recompiles the project and updates the live site (2 to 5 minutes).
You never have to touch the Hostinger panel to update the site.
Where each thing happens
| Place | What it is | What you do there |
|---|---|---|
| Terminal | The command screen (open it in VS Code with Ctrl + ') | Git commands: add, commit, push |
| The GitHub site | github.com, the code repository in the cloud | Create the repository, check the uploaded files |
| The Hostinger panel | hpanel.hostinger.com | The initial deploy configuration (done once) |
2. Prerequisites
- Git installed on the computer. Check with
git --versionin the terminal. If it is missing, download it at https://git-scm.com/downloads. - A GitHub account (github.com).
- A Hostinger plan with Web Apps / Node.js support. In our case, the Cloud Startup plan, which includes 10 Web Apps and supports Next.js with Node.js 18.x, 20.x, 22.x and 24.x. The more basic shared plans lack that feature.
- A Next.js project working on your machine (it runs with
npm run dev).
3. Step 0: initial checks (in the terminal)
Done once, before anything else.
3.1 Check whether Git is installed
git --version- Expected answer: something like
git version 2.43.0. - If "git is not recognized" appears: install Git and reopen VS Code.
3.2 Check whether the project already has Git initialized
git status- A list of files appeared (or "nothing to commit") → Git already exists in the folder. Skip
git init. fatal: not a git repositoryappeared → rungit initin Step 5.
How to know whether create-next-app generated the project: open package.json and check whether "next" exists inside "dependencies". Another sign: the default create-next-app .gitignore (with # next.js, # vercel sections and so on).
3.3 Identify yourself to Git (done once per computer)
Git stamps each change with a name and an email:
git config --global user.name "Your Name"
git config --global user.email "youremail@example.com"Use the same email as the GitHub account. No confirmation message appears; if no error came up, it worked.
4. Step 1: preparing the project (in VS Code / the terminal)
4.1 The .gitignore file
.gitignore is a list of files that should NOT go to GitHub. It exists for two reasons:
- Security:
.envfiles hold passwords and secret keys. They cannot sit exposed in the repository. - Size and necessity: folders such as
node_modules(libraries) and.next(the build result) get generated on their own. Hostinger recreates both on the server.
create-next-app generates the file ready to go. The minimum content required:
# dependencies
/node_modules
# next.js
/.next/
/out/
# production
/build
# env files
.env*
# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# misc
.DS_Store
*.pem
.vercel
*.tsbuildinfo
next-env.d.tsNote: the .env* line blocks any file starting with .env, an eventual .env.example included. If one day the team wants to version a template file (with no real passwords), adding !.env.example to .gitignore is enough (the ! means "except this one").
4.2 Check package.json
Hostinger uses the package.json scripts to install, compile and start the site. Confirm these exist:
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start"
}Also make sure next, react and react-dom sit in dependencies (not in devDependencies).
4.3 Test the production build on your machine
npm run buildThis command compiles the project the same way Hostinger will compile it. If it fails on your machine, it will fail on deploy. The npm run dev mode tolerates errors (types, ESLint, dynamic pages) that the production build forgives in no way. Fix any error before moving on.
5. Step 2: create the repository (on the GitHub site)
A repository is the "project folder in the cloud", with the history of every change.
- Go to https://github.com and log in.
- Click the
+in the top right corner → New repository. - Fill in: - Repository name: a name with no spaces and no accents (in our case,
zumkai). - Visibility: Private 🔒 (you alone see the code; Hostinger reaches it anyway, because it gets authorized later). - Check NOTHING under "Initialize this repository with" (no README, no .gitignore, no license). Reason: the project already exists on the computer; if GitHub creates files on its own, the first push hits an "unrelated histories" conflict. - Click Create repository.
- On the "Quick setup" page that opens, copy the URL of the repository (leave the HTTPS option selected):
https://github.com/sergioarantes/zumkai.git6. Step 3: send the code to GitHub (in the terminal)
Commands run one at a time, with Enter after each.
6.1 git init (only if needed)
git initIt turns the folder into a Git project. Skip it if the git status from Step 0 already worked (our case).
6.2 Stage every file
git add .Translation: "Git, stage EVERY file in the folder for saving" (the dot means "everything"). The files listed in .gitignore get ignored on their own. This command shows no response, and silence is success.
6.3 Save a "snapshot" of the project
git commit -m "First version of the project"It saves the project's current state with the description in quotes. Each commit is a point in the history you can return to. The answer shows a summary, along the lines of 5 files changed, 28 insertions(+).
6.4 Rename the main branch to main
git branch -M mainGitHub's current default is main; older projects use master. Run it even if it is already called main (it does no harm).
6.5 Connect the folder to the GitHub repository
First, check whether a connection already exists:
git remote -v- Nothing appears → connect with the URL copied in Step 2:
git remote add origin https://github.com/sergioarantes/zumkai.git- A wrong URL already appears → correct it with:
git remote set-url origin https://github.com/sergioarantes/zumkai.gitTranslation: "this project's remote address, nicknamed origin, is this one".
6.6 Send it for real (the first push)
git push -u origin main- The first time, a window or browser opens asking for a GitHub login → click Sign in with your browser and authorize. It stops asking after that.
- The
-u origin mainis necessary on the first push alone; after that,git pushsuffices.
Success output (a real example from our deploy):
Writing objects: 100% (845/845), 4.52 MiB | 3.01 MiB/s, done.
To https://github.com/sergioarantes/zumkai.git
* [new branch] main -> main
branch 'main' set up to track 'origin/main'.6.7 Check on the GitHub site
Open the repository page and press F5. Verify:
- ✅ The project files appear
- ✅
node_modules/is NOT there - ✅
.next/is NOT there - ✅ No
.envfile is there - ✅
.claude/settings.local.jsonis NOT there
7. Step 4: deploy on Hostinger (in the hPanel)
Configuration done once.
7.1 Start the deploy
- Go to https://hpanel.hostinger.com and log in.
- Side menu → Websites → the + Add Website button.
- Choose Deploy Web App ("Deploy your app from GitHub or upload files").
7.2 Connect GitHub
- Choose the option to import via GitHub (not "upload files").
- GitHub opens asking for authorization → click Authorize. - If it asks between "All repositories" and "Only select repositories", choose Only select repositories and check the project repository alone (safer).
- Back in Hostinger, select the repository (zumkai) and the branch (main).
7.3 Review the build settings
Hostinger detects the framework on its own. The configuration used in our deploy:
| Field | Value | Note |
|---|---|---|
| Framework preset | Next.js | Detected automatically |
| Branch | main | The branch that fires the deploy |
| Node version | 22.x | An LTS version, compatible with Next.js |
| Root directory | ./ | Because package.json sits at the repository root |
| Build and output settings | Default for Next.js | Leave it alone. The default runs npm ci + npm run build + npm start |
7.4 Environment variables
- If the project has NO
.envfile (our case) → fill in nothing in this section. - If the project HAS a
.envwith content → register each line in the Environment variables section (Add): what comes before the=is the Name, what comes after is the Value. It is necessary because.gitignoreprevents (on purpose) the.envfrom going to GitHub, so Hostinger knows none of those values. - Careful:
NEXT_PUBLIC_*variables get baked in at build time. If you change one in the panel, firing a new deploy is necessary for it to take effect.
7.5 Run the deploy
- Click the Deploy → button.
- Follow the log (install → build → start). It takes 2 to 5 minutes. Leave the page open.
- At the end, "Deployment completed!" appears with a preview of the live site.
- The domain (zumkai.com) already points at the application.
8. Step 5: automatic sync and the daily flow
From here on, every push to the main branch updates the site on its own. Hostinger detects it, recompiles and publishes without help.
8.1 The 3 commands for every update
git add .
git commit -m "describe here what changed"
git push| Command | What it does | Expected answer |
|---|---|---|
git add . | Gathers every change (modified, new, deleted) | Nothing (silence = success) |
git commit -m "..." | Saves with a description. Change the text each time, describing the real change | A summary: X files changed... |
git push | Sends to GitHub → Hostinger updates the site in 2–5 min | Several lines ending in main -> main |
The one-line version (the && runs the next command only if the previous one succeeded):
git add . && git commit -m "describe here what changed" && git push8.2 Recommended routine before each push
npm run dev→ test the change in the local browser.npm run build→ confirm it compiles with no error (what fails here fails on deploy).git status→ check what is about to get sent.git add .takes everything changed in the folder, not the last file you touched alone.git add .→git commit -m "..."→git push.
8.3 How to follow a deploy
In hPanel → the Web App dashboard → the Deployments area: it shows each deploy with its status (In progress / Completed / Failed), branch, commit and date. Clicking a deploy opens the full log.
8.4 How to check whether the site updated
Open the site and reload ignoring the cache: Ctrl + Shift + R. For a 100% clean test, use an incognito window (Ctrl + Shift + N).
9. Troubleshooting
The deploy failed on Hostinger (status "Failed")
Open the deploy log in the Deployments area. The most common causes:
- A build error → reproduce it on your machine with
npm run buildand fix it. It is cause number 1. - A missing environment variable → register it in the panel and redeploy.
- A dependency in
devDependenciesthat belongs independenciesinpackage.json(the production build installs no devDependencies).
The site failed to update after the push
- Check on GitHub whether the commit arrived (the repository page shows "X minutes ago").
- Check the Deployments area in hPanel (the deploy may be in progress or may have failed).
- Reload with
Ctrl + Shift + R(browser cache is a frequent cause of "nothing changed"). - If the site updated and came out unstyled or broken, see the CDN case below.
The site appears "broken" or unstyled after a deploy (⚠️ a real case that happened in this project)
Symptom: right after a push or deploy, the site loads the "naked" content alone: text and links appear, with no colors, fonts or layout. Ctrl + Shift + R fails to solve it.
Cause: a version mismatch caused by Hostinger's CDN cache. It works like this: on each build, Next.js generates the CSS and JS files with unique names (for example, 3z2vuf_k-6jbb.css) that change on every compilation. The CDN (the network that keeps copies of the site to deliver it faster) can keep serving the old version's HTML, which asks for files with old names, and those files no longer exist on the server. Result: 404 errors and an unstyled site. Ctrl + Shift + R fails to solve it because it clears the browser's cache, not the server's or CDN's.
How to confirm the diagnosis (2 minutes):
- Open the site in Chrome and press F12 (developer tools).
- Go to the Console tab (or Network and reload with
Ctrl + R). - If errors like these appear, this is the problem:
GET https://yoursite.com/_next/static/chunks/xxxxx.css 404 (Not Found)
GET https://yoursite.com/_next/static/chunks/xxxxx.js 404 (Not Found)Checking the deploy log in Deployments also pays off: in this scenario it appears Completed, with Compiled successfully, meaning the code is healthy and the problem is cache alone.
Solution (in order):
- Redeploy: in the Web App panel, click the Redeploy button and wait for it to finish. That republishes the HTML and the static files of the same version.
- Clear the CDN cache: in hPanel, go to Websites → [your site] → Performance → CDN and click Flush cache.
- Wait 1 to 2 minutes and test in an incognito window (
Ctrl + Shift + N), which guarantees zero interference from the browser cache.
Notes about the CDN screen: the Development mode button switches the CDN cache off for a few hours (useful during stretches of repeated testing); Disable turns the CDN off for good (not recommended, since it speeds the site up). The yellow Console warning about "resource was preloaded using link preload" is harmless and disappears alongside once the 404s get resolved.
Vulnerabilities detected by Hostinger (⚠️ a real case that happened in this project)
Symptom: the Websites → [site] → Security → Vulnerabilities panel shows vulnerabilities with a "Requires manual patching" warning, listing packages (for example, postcss, sharp), severity and the fixed version.
What it means: it is neither an intrusion nor an error in your code. They are flaws discovered in third-party libraries the project uses. The fixes already exist in newer versions; "manual patching" means "update the versions in your project" and nothing more. The fix happens in the terminal, and the automatic deploy carries it to the server.
The fix, step by step:
- Make sure every change sits in a commit (
git status), so you can back out with ease if something goes wrong. - See the vulnerabilities on your machine:
npm auditIt is the same database Hostinger uses. Note the packages and the target versions.
- Try the safe automatic fix:
npm audit fixIf npm audit comes back clean after that, skip to step 6.
- Find out whether the vulnerable package is a direct dependency or a "hitchhiker":
npm ls package-nameThe command shows the tree. A real case from this project: postcss@8.4.31 and sharp@0.34.5 appeared inside next@16.2.11, meaning they were no direct dependencies and came along for the ride with Next.
- Update the right way, according to the case:
- A direct dependency (it appears in
package.json) → update it in place:
npm install package-name@^fixed-version- A "hitchhiker" dependency (it appears nowhere in
package.json) → add anoverridesblock topackage.json, at the same level asdependencies(never inside it), and runnpm install. A real example used in this project:
"overrides": {
"postcss": "^8.5.12",
"sharp": "^0.35.0"
}overrides means: "no matter who asked for these libraries, Next included, use at least these versions".
- Verify it applied:
npm ls package-name # it should show the new version (it can appear as "overridden"/"deduped")
npm audit # expected: found 0 vulnerabilities- Test before shipping (do not skip):
npm run buildPackages such as postcss (CSS) and sharp (images) touch the visual side, so running npm run dev and checking the site in the browser also pays off.
- Ship the fix:
git add .
git commit -m "Fix dependency vulnerabilities"
git pushThe commit should show 2 files changed (package.json + package-lock.json). If it shows "nothing to commit", the update never happened, so go back to step 5.
- Check in the panel: the Security → Vulnerabilities scan is not instant; it can take a few hours to come back clean. The immediate technical confirmation is
npm audit'sfound 0 vulnerabilities.
A preventive routine: run npm audit from time to time and follow the alerts in the Hostinger panel or from Dependabot on GitHub (the same database). New vulnerabilities in dependencies are routine in any project, and they signal no error by whoever developed it.
git push asks for a password and refuses it
GitHub accepts no ordinary password in the terminal. The solutions:
- Use the browser login when the window opens (recommended); or
- Create a token in GitHub → Settings → Developer settings → Personal access tokens and use it in place of the password.
remote origin already exists when running git remote add
A connection already exists. Correct the URL with:
git remote set-url origin https://github.com/user/repository.git"LF will be replaced by CRLF" warnings
It is no error. It is line-ending normalization between Windows and Linux/Mac. Ignore it.
A file that should have stayed out went to GitHub
- Add its path to
.gitignore. - Remove it from Git's control (without deleting it from the computer):
git rm --cached path/to/file- Commit and push.
10. Quick reference
Commands used a single time (setup)
git --version # check the Git installation
git config --global user.name "Your Name"
git config --global user.email "email@example.com"
git init # only if git status returns "not a git repository"
git branch -M main # rename the branch to main
git remote add origin URL # connect to the GitHub repository
git push -u origin main # the first pushDay-to-day commands (every update)
git add .
git commit -m "description of the change"
git pushRead-only commands (they change nothing)
git status # what is modified / pending
git remote -v # which repository the folder connects to
git log --oneline # a condensed commit history
npm audit # vulnerabilities in the project's dependencies
npm ls package # where and which version of a package is installed11. Glossary
| Term | Meaning |
|---|---|
| Terminal | The command screen. In VS Code: Ctrl + ' or the Terminal → New Terminal menu |
| Git | The program that controls code versions on your computer |
| GitHub | The site that hosts Git repositories in the cloud |
| Repository | The "project folder in the cloud", with the whole history |
| Commit | A saved "snapshot" of the project at one moment, with a description |
| Branch | A line of development. The main one is called main |
| Push | Sending commits from the computer to GitHub |
| Origin | The default nickname for the connection to the remote repository |
| Deploy | The process of publishing the application on the server |
| Build | Compilation of the project into the optimized production version |
.gitignore | The list of files Git should ignore (never send) |
| Environment variable | A configuration value (a database password, for example) defined outside the code |
| CI/CD | The technical name for what we assembled: continuous integration and delivery |
Documentation produced from the real setup process of the zumkai project, on 23 July 2026.
Read next
Motion •
Motion Design for the Web: The Complete Guide
Scroll, text, images and video: the complete catalog of motion techniques for the web, with implementation in Next.js and the cases where each one pays off.
- motion
- scroll
The definitive guide — a Next.js site built around motion and scroll
The scroll foundation that, when missing, keeps the animations from working at all: Lenis, GSAP and Next.js wired in the right order and the mistakes to avoid.
- next.js
- lenis
Instituto +Brasal redesign — complete documentation of the process
From analyzing the skills catalog to running six competing stacks on the Instituto +Brasal redesign, with every prompt used and what each stack delivered.
- process
- skills
- part 1/2


