thelfensdrfer / php-gitolite

Read and write Gitolite config with php.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Build Status

Read config

Parse simple gitolite configs.

What can be parsed

  • Users
  • Groups
  • Repositories and permissions

What cannot be parsed

  • @all
  • Including another config file
  • Rule accumulation

Usage

Group[s] consist of of other Group[s] and User[s].

$config = new VisualAppeal\Gitolite\Config($pathToConfig);

var_dump($config->getGroups());
var_dump($config->getRepositories());

Write config

Save config after a change was made

$config = new VisualAppeal\Gitolite\Config($pathToConfig);

// Make changes
// ...

$config->saveAs($pathToNewOrOldConfig);
$config->commitAndPush();

Add user

$config->getGroups()['admins']->addUser('tom', [
	'keys' => [
		'/absolute/path/to/public/key.pub' => 'relative/path/in/keydir.pub'
	],
]);

About

Read and write Gitolite config with php.

License:MIT License


Languages

Language:PHP 100.0%