Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Checkout of git repository in pure PHP

I need to to a git checkout in pure PHP. I already tried this ( http://www.phpclasses.org/package/5310-PHP-Retrieve-project-files-from-GIT-repositories.html ) with HTTP and SASL, but I didn't really work. Then I took a look at GLIP ( https://github.com/patrikf/glip ), but that doesn't seem to have any functionality like this. Basically I need to

-replicate/clone a remote git repository

-"extract" master branch files into a specified directory

The main problem with PHP GIT is, that it just didn't supported all possible changes you could do in a commit. Only new files, no moving around of files. And it was also unable to extract files.

/edit: git is not installed and I also cannot install git

like image 881
dom0 Avatar asked Aug 17 '11 18:08

dom0


1 Answers

You can try with

  • https://github.com/teqneers/PHP-Stream-Wrapper-for-Git

Git Streamwrapper for PHP is a PHP library that allows PHP code to interact with one or multiple Git repositories from within an application. The library consists of a Git repository abstraction that can be used to programatically access Git repositories and of a stream wrapper that can be hooked into the PHP stream infrastructure to allow the developer to use file and directory access functions directly on files in a Git repository. The library provides means to access status information on a Git repository, such as the log, the current repository status or commit information, as well.

It requires Git to be installed on the machine though and is in beta as of this writing.

like image 144
Gordon Avatar answered Sep 23 '22 00:09

Gordon