We don’t allow questions seeking recommendations for software libraries, tutorials, tools, books, or other off-site resources. You can edit the question so it can be answered with facts and citations.
Closed 8 years ago.
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(3)
https://github.com/kbjr/Git.php
Git.php 是一个包装类git 调用使用
proc_open
而不是exec
来运行命令。虽然它没有推/拉方法,但它确实有一个用于运行自定义 git 命令的通用run
方法,因此可以像这样使用它:它也有用于克隆的方法(
clone_to
和clone_from
进行本地克隆,clone_remote
进行远程克隆)。https://github.com/kbjr/Git.php
Git.php is a wrapper class around git calls that uses
proc_open
instead ofexec
to run the commands. While it does not have push/pull methods, it does have a generalrun
method for running custom git commands, so it could be used something like this:It also does have methods for cloning (
clone_to
andclone_from
which do local cloning andclone_remote
for remote cloning).一种可能性是使用 PHP 的 SSH 库通过连接回 Web 服务器来执行这些操作?
或者我发现这组类 允许您通过 HTTP 克隆和读取其他元数据,但不能推送或拉取。然而,如果您有足够的勇气扩展它们来做到这一点,那么这可能是一个起点。我可以想象复制这些流程并使其与各种服务器版本等兼容将需要大量工作。
[更新2014年3月23日,在收到赞成票后 - 谢谢!]
我确实找到了一些方法来尝试实现上述内容(我正在寻找一个实现,画了一个空白,所以尝试编写自己的),并且正如我想象的那样很难!实际上我放弃了它,因为我找到了一种更简单的方法来在不同的架构中实现这一目标,但这是我尝试编写的类。它本质上是有效的,但对我工作的环境变化很脆弱(即它不能很好地处理错误或问题)。
它使用:
(注意 - 我必须快速从代码中删除一些细节才能发布它。所以你需要摆弄将其集成到您的应用程序/命名空间等中)
One possibility is to use PHP's SSH library to perform those actions by connecting back to the web server?
Or I found this set of classes which allow you to you to clone and read other metadata over HTTP, but not push nor pull. However it could be a starting point if you're brave enough to extend them to do that. I can imagine it would be a lot of work to replicate these processes and keep them compliant with various server versions etc.
[UPDATED 23/03/2014, after receiving an upvote - thanks!]
I did get some way trying to implement the above (I was searching for an implementation, drew a blank so tried to write my own), and it was hard as I thought! I actually abandoned it as I found a simpler way to achieve this in a different architecture, but here's the class I wrote trying. It essentially works, but was brittle to the environmental variations I was working in (i.e. it doesn't cope very well with errors or problems).
It uses:
(Note - I had to quickly strip out a few details from the code to post it. So you'll need to fiddle about a bit to integrate it into your app/namespace etc.)
这看起来很有希望:http://gitphp.org(链接已损坏;请参阅 存档版本)
我想这会为你做的。这是它的描述:
This looks promising: http://gitphp.org (broken link; see an archived version)
I think that will do it for you. Here is the description of it: