{"id":12220,"date":"2025-06-12T13:43:10","date_gmt":"2025-06-12T07:58:10","guid":{"rendered":"https:\/\/nestnepal.com\/blog\/?p=12220"},"modified":"2026-06-24T05:10:10","modified_gmt":"2026-06-24T05:10:10","slug":"git-version-control-your-website-using-cpanel","status":"publish","type":"post","link":"https:\/\/nestnepal.com\/blog\/git-version-control-your-website-using-cpanel\/","title":{"rendered":"Using Git with cPanel: How to Version Control Your Website (2025 Pro Guide)"},"content":{"rendered":"\n
Gone are the days of dragging and dropping files over FTP and manually updating production websites. Today, smart developers and digital businesses rely on control systems<\/strong> like Git Version<\/a> to manage their codebases, collaborate effectively, and streamline deployments.<\/p>\n\n\n\n And here\u2019s the good news: cPanel comes with built-in Git support!<\/strong> That means you can bring the power of Git workflows into your shared or VPS hosting<\/a> environment.<\/p>\n\n\n\n This guide will walk you through everything, from setting up a repository to deploying updates from Git to your live website, all securely and professionally.<\/p>\n\n\n\n Before jumping into the steps, let\u2019s understand why Git and cPanel together make so much sense:<\/p>\n\n\n\n To follow this guide, you\u2019ll need:<\/p>\n\n\n\n \u2705 Your Git repo is now live inside your hosting account.<\/p>\n\n\n\n Using Git securely requires SSH authentication<\/strong>.<\/p>\n\n\n\n ssh-keygen -t rsa -b 4096 -C “your@email.com”<\/p>\n\n\n\n cat ~\/.ssh\/id_rsa.pub<\/p>\n\n\n\n Done! You can now push to your repo securely.<\/p>\n\n\n\n cd your-local-project-folder<\/p>\n\n\n\n git init<\/p>\n\n\n\n git remote add live ssh:\/\/youruser@yourdomain.com\/home\/youruser\/repositories\/my-website<\/p>\n\n\n\n git add.<\/p>\n\n\n\n git commit -m “Initial commit”<\/p>\n\n\n\n git push live master<\/p>\n\n\n\n Now your code lives on your server.<\/p>\n\n\n\n If you\u2019re using GitHub or GitLab, you can instead have cPanel pull<\/strong> directly from those remotes. More on that later.<\/p>\n\n\n\n Just because the repo lives on your server doesn\u2019t mean it\u2019s live yet.<\/p>\n\n\n\n Let\u2019s deploy it:<\/p>\n\n\n\n Boom! Git now powers your website.<\/p>\n\n\n\n Want changes to go live automatically every time you push? Set up auto-deploy:<\/p>\n\n\n\n #!\/bin\/bash<\/p>\n\n\n\n GIT_WORK_TREE=\/home\/youruser\/public_html git checkout -f<\/p>\n\n\n\n chmod +x post-receive<\/p>\n\n\n\n Now every push = auto update.<\/p>\n\n\n\n Let\u2019s say you\u2019re deploying a Laravel app:<\/p>\n\n\n\n Bonus: You can use .env.production and symlink it as .env for live config.<\/p>\n\n\n\n With Git and cPanel working together, your workflow becomes:<\/p>\n\n\n\n Whether you\u2019re a solo developer, an agency, or a startup, mastering Git-based deployment on shared hosting gives you an edge.<\/p>\n\n\n\n So go ahead and set up that repo, push your code, and take control of your website\u2019s future! Need a Git-friendly hosting provider in Nepal?<\/strong> Most modern cPanel hosts support Git (like Nest Nepal<\/a>), so choose one that gives you SSH and Git Version Control in your panel.<\/p>\n\n\nWhy Use Git with cPanel?<\/strong><\/h2>\n\n\n\n
\n
Prerequisites<\/strong><\/h2>\n\n\n\n
\n
Step 1: Create a Git Repository in cPanel<\/strong><\/h2>\n\n\n\n
\n
\n
Step 2: Set Up SSH Access (For Secure Pushes)<\/strong><\/h2>\n\n\n\n
On Your Local Computer:<\/strong><\/h3>\n\n\n\n
\n
On cPanel:<\/strong><\/h3>\n\n\n\n
\n
Step 3: Add Remote & Push Code from Local Git<\/strong><\/h2>\n\n\n\n
From your terminal:<\/strong><\/h3>\n\n\n\n
Step 4: Deploy the Code to Public_HTML (Live Website)<\/strong><\/h2>\n\n\n\n
\n
\n
Optional: Auto-Deploy on Push (Post-Receive Hook)<\/strong><\/h2>\n\n\n\n
\n
\n
Git Workflow Example: Laravel App Deployment<\/strong><\/h2>\n\n\n\n
\n
Solution:<\/strong><\/h3>\n\n\n\n
\n

Best Practices for Git + cPanel Deployments<\/strong><\/h2>\n\n\n\n
\n
Recap: Git-Powered Hosting = Smarter Web Development<\/strong><\/h2>\n\n\n\n
\n