A php client interfacing with the rest api from node-git-rest-api

0.0.14 2017-01-16 11:32 UTC

This package is auto-updated.

Last update: 2022-06-26 22:21:02 UTC


Build Status

PHP client interfacing with RESTful API from server running node-git-rest-api, as dockerized in docker-node-git-rest-api


Published on packagist

composer require shadiakiki1986/git-rest-api-client


Launch a node-git-rest-api server

docker run -p 8081:8081 -it shadiakiki1986/docker-node-git-rest-api

To make changes to a file in a repository

$git        = new GitRestApi\Client('http://localhost:8081');
// clone a git repository on github
$remote = '';
$repo = $git->cloneRemote($remote);
// update a file called 'filename' in the repository
$repo->put('filename','some content');
// commit the changes
$repo->commit('a new commit message');
// push to the remote

To pull changes and get contents of a file

$git        = new GitRestApi\Client();
// get already-cloned git repository
$repo = $git->get('git-data-repo-testDataRepo');
// pull changes
// get contents of file

Testing locally

' VERY IMPORTANT NOTE: Do NOT directly run node-git-rest-api on your local machine and test this package against it. The tests contain a few git config --global ... calls, which would change your username/email on your local machine, and hence screwing up your git commits in all other repositories. '

Launch a node-git-rest-api server

docker run -p 8081:8081 -it shadiakiki1986/docker-node-git-rest-api

composer test will test everything except a successful push.

export GitRestApiTestUrl=
composer test

will test everything, including the successful push.

For testing against my own bitbucket private repo:

PRIVATE_REMOTE= PRIVATE_FILE=filename vendor/bin/phpunit tests/GitRestApi/PrivateTest.php

Testing on travis

Check git-data-repo



  • push is not pushing to github
  • travis not passing