# Setting up git and git hooks

**URL:** <https://forum.infinityfree.com/t/setting-up-git-and-git-hooks/44336>\
**Category:** Hosting Support\
**Created:** [April 24, 2021, 11:16am UTC](https://forum.infinityfree.com/t/setting-up-git-and-git-hooks/44336 "2021-04-24T11:16:57Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![codeBang](https://forum.infinityfree.com/letter_avatar/codebang/32/5_5575768a8748004e209b776fc1b2916d.png) [@codeBang](https://forum.infinityfree.com/u/codeBang)\
**Post date:** [April 24, 2021, 11:16am UTC](https://forum.infinityfree.com/t/setting-up-git-and-git-hooks/44336/1 "2021-04-24T11:16:57Z")

</div>

### Username (e.g. epiz\_XXX) or Website URL

epiz\_28394007

### Other Information

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

---

<div class="post-metadata">

**Author:** ![anon19508339](https://forum.infinityfree.com/letter_avatar/anon19508339/32/5_5575768a8748004e209b776fc1b2916d.png) [@anon19508339](https://forum.infinityfree.com/u/anon19508339)\
**Post date:** [April 24, 2021, 11:37am UTC](https://forum.infinityfree.com/t/setting-up-git-and-git-hooks/44336/2 "2021-04-24T11:37:32Z")

</div>

I don’t think if you can use git here.

---

<div class="post-metadata">

**Author:** ![Admin](https://forum.infinityfree.com/user_avatar/forum.infinityfree.com/admin/32/36437_2.png) [@Admin](https://forum.infinityfree.com/u/Admin)\
**Post date:** [April 24, 2021, 1:59pm UTC](https://forum.infinityfree.com/t/setting-up-git-and-git-hooks/44336/3 "2021-04-24T13:59:03Z")

</div>

We don’t have Git or SSH. So deploying a site from Git isn’t easy.

[Premium cPanel](https://infinityfree.net/premium/) 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.

---

<div class="post-metadata">

**Author:** ![alexvf](https://forum.infinityfree.com/user_avatar/forum.infinityfree.com/alexvf/32/14357_2.png) [@alexvf](https://forum.infinityfree.com/u/alexvf)\
**Post date:** [April 24, 2021, 2:46pm UTC](https://forum.infinityfree.com/t/setting-up-git-and-git-hooks/44336/4 "2021-04-24T14:46:53Z")

</div>

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.

> **[Deploy websites with Bitbucket pipelines and Git-ftp · Stephan Wagner](https://stephanwagner.me/deploy-websites-with-bitbucket-pipelines-and-git-ftp)**
>
> Tutorial for using bitbucket pipelines with Giot-ftp to deploy your websites to a FTP server.

I don’t know if there’s a similar tool (like Bitbucket’s pipelines) on Github, though.

---

<div class="post-metadata">

**Author:** ![codeBang](https://forum.infinityfree.com/letter_avatar/codebang/32/5_5575768a8748004e209b776fc1b2916d.png) [@codeBang](https://forum.infinityfree.com/u/codeBang)\
**Post date:** [April 24, 2021, 3:19pm UTC](https://forum.infinityfree.com/t/setting-up-git-and-git-hooks/44336/5 "2021-04-24T15:19:26Z")

</div>

Thanks!  
I can use BitBucket instead of GitHub for this website.  
Let me check out that link you sent.

---

<div class="post-metadata">

**Author:** ![Admin](https://forum.infinityfree.com/user_avatar/forum.infinityfree.com/admin/32/36437_2.png) [@Admin](https://forum.infinityfree.com/u/Admin)\
**Post date:** [April 25, 2021, 9:10am UTC](https://forum.infinityfree.com/t/setting-up-git-and-git-hooks/44336/6 "2021-04-25T09:10:23Z")

</div>

> [@alexvf](#):
>
> 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.

---

<div class="post-metadata">

**Author:** ![codeBang](https://forum.infinityfree.com/letter_avatar/codebang/32/5_5575768a8748004e209b776fc1b2916d.png) [@codeBang](https://forum.infinityfree.com/u/codeBang)\
**Post date:** [April 26, 2021, 7:31pm UTC](https://forum.infinityfree.com/t/setting-up-git-and-git-hooks/44336/7 "2021-04-26T19:31:30Z")

</div>

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.

Thanks for the suggestion.

---

<div class="post-metadata">

**Author:** ![Greenreader9](https://forum.infinityfree.com/user_avatar/forum.infinityfree.com/greenreader9/32/22847_2.png) [@Greenreader9](https://forum.infinityfree.com/u/Greenreader9)\
**Post date:** [April 26, 2021, 7:34pm UTC](https://forum.infinityfree.com/t/setting-up-git-and-git-hooks/44336/8 "2021-04-26T19:34:39Z")

</div>

Glad to hear it, make sure you mark the helpful post solution!

---

<div class="post-metadata">

**Author:** ![system](https://infinityfree-forum-uploads.s3.dualstack.eu-central-1.amazonaws.com/original/3X/b/0/b024fd3fa88bae093c9576e55c2c94e33f890206.svg) [@system](https://forum.infinityfree.com/u/system)\
**Post date:** [May 11, 2021, 7:34pm UTC](https://forum.infinityfree.com/t/setting-up-git-and-git-hooks/44336/9 "2021-05-11T19:34:50Z")

</div>

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.
