I have a remote ubuntu server that stores the live version of my code from GitHub. Every time I push from my local computer with git, I want the remote server to automatically pull the code. Other guides usually talk about adding a PHP file to a web directory though my server doesn't have a direct HTTP URL or a www directory since it's not used for a website.
I've also tried creating a post-receive
hook but to no result, I don't know if I'm doing it wrong or not.
My post-receive file in .git/hooks:
#!/bin/bash
git --work-tree=/home/folder/anotherFolder/repo --git-dir=/home/folder/anotherFolder/repo checkout -f
I'd like to note that I'm also not the only one that will be pushing to the repository, so it should support commits from different devices.