Skip to content

Read and write Gitolite config with php.

License

Notifications You must be signed in to change notification settings

thelfensdrfer/php-gitolite

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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'
	],
]);