承接 ausi/remote-git 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

ausi/remote-git

最新稳定版本:0.2.6

Composer 安装命令:

composer require ausi/remote-git

包简介

Edit git repositories remotely

README 文档

README

Build Status Coverage Packagist Version Downloads MIT License

This library provides methods to handle git repositories remotely without having to clone the whole repo. It uses the Symfony process component to run the git client.

Usage

<?php
use Ausi\RemoteGit\Repository;
use Ausi\RemoteGit\GitObject\File;
use Ausi\RemoteGit\Exception\ConnectionException;
use Ausi\RemoteGit\Exception\PushCommitException;

$repo = new Repository('ssh://git@github.com/ausi/remote-git.git');

try {
    $repo->connect();
} catch(ConnectionException $exception) {
    // Unable to connect to the specified server
}

$headCommit = $repo->getBranch('main')->getCommit();

$newTree = $headCommit
    ->getTree()
    ->withFile(
        'example.txt',
        'Example content…',
    )
;

$newCommit = $repo->commitTree($newTree, 'Add example', $headCommit);

try {
    $repo->pushCommit($newCommit, 'main');
} catch(PushCommitException $exception) {
    // Unable to push to the specified remote, e.g. no write access
}

Installation

To install the library use Composer or download the source files from GitHub.

composer require ausi/remote-git

Speed

Speed comparison of cloning https://gitlab.com/linux-kernel/stable.git and reading the contents of a file:

Command Network Disk Space Time
git clone 3.21 GB 4.6 GB 901 s
git clone --depth 1 207 MB 1.4 GB 77 s
git clone -n --depth 1 207 MB 216 MB 46 s
getBranch(…)->getCommit()->getTree()->getFile(…)->getContents() 2.49 MB 2.57 MB 5.8 s

Naturally, this is strongly dependent on many factors like bandwidth and CPU power and should only give a rough idea of this projects purpose, namely reading or writing small bits of data from or to a remote GIT repository.

统计信息

  • 总下载量: 904
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 4
  • 点击次数: 0
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 4
  • Watchers: 3
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-09-11