How to deploy sites via GIT on Hostinger
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
Step-by-Step Instructions
Access Git Deployment in hPanel
Create New Git Repository Connection
main or master). Set the target directory path where files should be deployed, typically public_html for main domain.Configure Repository Authentication
Set Up Deployment Settings
.git/, node_modules/, or *.md. Click Create to save the configuration.Perform Initial Deployment
Test Automatic Deployment
Configure Build Commands (Optional)
npm install && npm run build. Set the correct Output directory if your build process creates files in a specific folder.Set Up Webhook for External Triggers
Common Issues & 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.