ausi/remote-git

Edit git repositories remotely

Maintainers

๐Ÿ‘ ausi

Package info

github.com/ausi/remote-git

pkg:composer/ausi/remote-git

Fund package maintenance!

ausi

Statistics

Installs: 951

Dependents: 1

Suggesters: 0

Stars: 4

Open Issues: 0

0.2.6 2026-01-09 10:51 UTC

Requires

Suggests

None

Provides

None

Conflicts

None

Replaces

None

MIT 13761697226ce51a68142027863f3e60a60d5331

  • Martin Auswรถger <martin.woop@auswoeger.com>

gitremotecommit

This package is auto-updated.

Last update: 2026-06-28 12:17:52 UTC


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.