I have setup a repository in Github. I have used SSH
protocol to establish connection to that repo in my web hosting. Then I have cloned the repo without the project folder like this.
git clone git@github.com:{username}/{git-name} .
All works without any problem.
Now, I want to use that repo as the final copy of my website i.e. every time I update the repo, my website will also be updated. So, I created a PHP script which contains
`git pull`
I put the script link as web hook url in Github settings. But nothing happens when I update my repo.
I don't understand what's the problem. Is it because I have cloned the site without repository folder?
Another problem is that, the .git
folder is present inside the main website which means everyone can access that. Is there any solution to that?
I am pretty much new to Git and Github. So, detailed instruction will be very helpful. I am using Shared hosting with SSH shell access.