I would like to deploy the backend of my project outside of public_html, while the public files are on public_html. I don’t have much trouble when uploading the files manually to the file manager, but it’s a hassle for me to update them manually for every change on my git repository. So I wanted to use the deployment feature of Hostinger via git to upload them automatically.
I’ve made two Git repositories for my project, one for front-end (public) and one for backend
From the CPanel advance->git Create Repository Form, I manage to deploy my public files to the public_html folder. For the backend, I tried setting the directory field with the value of ../target_folder
, assuming that the root folder is public_html. But I’m receiving an error message stating that the directory is invalid.
Is there a workaround for this?
2
Answers
I recently got a reply from the Hostinger support team. Unfortunately, they do not support git deployment outside of public_html.
My workaround for the backend is to deploy it on public_html in a subfolder with .htaccess to restrict users. Though it may not be the best solution for other web-hosting services.
If you have ssh access in your hosting plan then you can create a new ssh key and do it manually by using
then you can do
as usual for evey push to your central repo. You can also try to automate things using cronjobs
I’m sorry this is a complete answer. I dont have enough reputation to comment. I hope this will be helpful to someone