I would like to set up git, a ssh directory, deployment key and git hooks on my infinityfree server so I can have automated deployment from my gitHub repo.
I will need to create a bare repository on the server and files will be pulled from my gitHub repo to the bare repository.
Are there any limitations or details I should be aware of?
Will my website work if key files (such as ‘index.php’) are inside a subfolder and not in ‘htdocs’ ?
Could you make any suggestions to make this successful?
Thanks
We don’t have Git or SSH. So deploying a site from Git isn’t easy.
Premium cPanel does come with a Git deployment system. They have their own deployment hook tool which IMO is a bit nicer to use than regular Git hooks.
One possible solution you could try is to use GitHub Actions to push code to your site with FTP. You still don’t have Git hooks, but some automation can be done through the CI pipeline.
I have at times done something like that with GitLab CI and lftp. It was REALLY slow but it worked. Somewhat.
I’m actually uploading automatically on GIT commit to Infinityfree but using Bitbucket’s pipelines.
Every time I commit a change or a new file from my PC to Bitbucket, it gets automatically uploaded to my InfinityFree hosting server.
I didn’t have to do a thing on InfinityFree. I develop on my computer, commit to Bitbucket and, using the pipelines, the commit action automatically uploads the changes to InfinityFree.
I don’t know if there’s a similar tool (like Bitbucket’s pipelines) on Github, though.
You can do that with GitHub Actions. Or GitLab CI. Or another CI tool of your choice. In the end, the tool just runs some commands in a Docker container, which can be done easily with most CI systems.
The git-ftp thing is useful though. Might be nice to write an article about it.
Hi there.
Thanks for the suggestion of using GitHub Actions.
I tried using BitBucket and deploy through a pipeline but I ran in to build issues.
I then tried using GitHub Actions and it worked!
I am now automatically uploading via ftp when I push files to my gitHub repo. It took some trial and error, but it was relatively straight forward to set up.