'Using github CLI (cli/cli) to deploy repo

Trying to deploy internal development from GitHub to a Centos 7 webserver, running into 2 issues.

Firstly, I'm using PHP and need to deploy the class files to a folder that is not /var/www/html/, where I have cloned the repository to using cd /var/www/ gh repo clone linkto/repo html (this may be the wrong thing to do).

Secondly, Prompting me to think that I've done the first part wrong, when trying to use gh repo sync linkto/repo i get the error can't determine source repository for GitUser/home because repository is not fork leading me to believe that instead of cloning I need to fork it. My intention here is that no code would ever be changed on the server-side just updated on GitHub then push to the server. Am I trying to do too much with GitHub? or am I trying to do it wrong?

EDIT: doing cd /var/www/html/ gh repo fork gh repo sync and setting a remote back to the origin has solved the second issue

Thanks,



Solution 1:[1]

In cd /var/www/html/

Running once to setup:

gh repo fork with a remote set to the origin

Each time to update:

gh repo sync setting the base repository each time to update

Then using https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks a server-side post-receive hook to move the classes directory to the desired location

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Tom