Search code examples
phpgitinstallationgit-clone

Clone Git Repo With PHP


I'm creating an installer which creates a database, user with permissions and then will pull through a website framework from an internal git repo. I've got everything pretty much working but struggling to find a way to do a git clone via php and download the files.

Any guidance or tips to do this would be appreciated, thanks.


Solution

  • I assume git is installed on the server you are running the code on. If so you can just run the command git clone ... from php using either the built-in exec or use a 3rd party library like Symfony's Process-component