Intermediate
How to deploy sites via GIT on Hostinger
Quick Answer
Deploy sites via Git on Hostinger by enabling Git deployment in the hPanel, connecting your repository, and setting up automatic or manual deployments. This allows you to push code changes directly from your Git repository to your live website.
Prerequisites
- Active Hostinger hosting account
- Git repository with your website code
- Basic knowledge of Git commands
- SSH access enabled on your hosting plan
1
Access Git Deployment in hPanel
Log into your Hostinger hPanel and navigate to Advanced section. Click on Git to access the Git deployment feature. Select the domain where you want to deploy your site from the dropdown menu.
Tip
Make sure your hosting plan supports Git deployment - this feature is available on Premium and Business plans.
2
Create New Git Repository Connection
Click Create new repository button. Enter your Git repository URL (GitHub, GitLab, or Bitbucket). Choose the branch you want to deploy from (usually
main or master). Set the target directory path where files should be deployed, typically public_html for main domain.Tip
Use HTTPS URLs for public repositories or SSH URLs if you have SSH keys configured.
3
Configure Repository Authentication
For private repositories, enter your Git credentials or add your SSH key. Click Add SSH Key if using SSH authentication, then paste your public key. For HTTPS, enter your username and personal access token in the authentication fields.
Tip
Use personal access tokens instead of passwords for better security with GitHub and GitLab.
4
Set Up Deployment Settings
Choose between Automatic deployment (deploys on every push) or Manual deployment. Configure excluded files by adding patterns to the Exclude files field, such as
.git/, node_modules/, or *.md. Click Create to save the configuration.Tip
Always exclude development files like node_modules, .env files, and documentation to keep your deployment clean.
5
Perform Initial Deployment
After creating the repository connection, click Pull to perform the initial deployment. Monitor the deployment log to ensure all files are copied correctly. Check that your website loads properly by visiting your domain.
Tip
The initial deployment may take a few minutes depending on your repository size.
6
Test Automatic Deployment
Make a test change to your repository and push it to the configured branch. If automatic deployment is enabled, check the Git section in hPanel to see the deployment status. Verify the changes appear on your live website.
Tip
You can view detailed deployment logs by clicking on any deployment entry in the history.
7
Configure Build Commands (Optional)
For projects requiring build processes, click Edit on your repository. Add pre-deployment commands in the Build commands section, such as
npm install && npm run build. Set the correct Output directory if your build process creates files in a specific folder.Tip
Build commands run in a Node.js environment, so you can use npm, yarn, or other Node.js tools.
8
Set Up Webhook for External Triggers
Copy the webhook URL provided in the Git settings. Add this webhook to your Git repository settings (GitHub: Settings > Webhooks, GitLab: Settings > Integrations). Configure the webhook to trigger on push events to automate deployments from external Git actions.
Tip
Webhooks provide faster deployment triggers compared to polling-based automatic deployment.
Troubleshooting
Authentication failed when connecting repository
Verify your credentials are correct. For GitHub, use a personal access token instead of your password. Ensure the token has
repo permissions for private repositories.Deployment fails with permission errors
Check that the target directory exists and has proper permissions. The deployment path should be
public_html for main domain or public_html/subdomain for subdomains.Files not updating after deployment
Clear your browser cache and check if caching is enabled in hPanel. Verify the correct branch is selected and that your latest commits are in that branch using
git log.Build commands failing during deployment
Check the deployment logs for specific error messages. Ensure your
package.json includes all required dependencies and that build commands work locally. Verify Node.js version compatibility in the build environment.Ready to get started with Hostinger?
Put this tutorial into practice. Visit Hostinger and follow the steps above.
Visit Hostinger →