DevOps Zone is brought to you in partnership with:

Sys engineer with a passion for finding new ways to use Operations to enable business to move faster and more effectively. Key buzzwords and areas of interest: linux, ruby, cloud, webops, devops, kanban! Joe is a DZone MVB and is not an employee of DZone and has posted 19 posts at DZone. You can read more from them at their website. View Full User Profile

Gitosis-ng: Simple, Self-service Git Repositories

04.29.2012
| 7882 views |
  • submit to reddit

Gitosis-ng — it’s gitosis with some new features to help users work with the git server. Mainly implemented with commands sent via ssh, ex:

list available commands:

$ ssh git@git.example.com help

    add-repo        : Create new repository. Usage: 'add-repo repo_name'
    help            : Get list of available commands
    list            : Get detailed list of git repositories
    list-json       : Get detailed list of repositories in JSON format
    list-short      : Get simple list of git repositories
    list-yaml       : Get detailed list of repositories in YAML format

List available repos:

$ ssh git@git.example.com list
    Repository  : myproject.git
     Initialized: no
     Your Access: read/write
     Owner      : jmiller
     URL        :
     Description:

     Repository  : otherproject.git
     Initialized: no
     Your Access: readonly
     Owner      : bsmith
     URL        :
     Description:

Create new repo:

$ ssh git@git.example.com add-repo myproject
 
    Created repository: myproject
 
    Next Steps:
      mkdir myproject
      cd myproject
      git init
      touch README
      git add README
      git commit -a -m 'first commit'
      git remote add origin git@GIT_SERVER_ADDRESS:myproject.git
      git push origin master
 
    Existing Git repo?
      cd myproject
      git remote add origin git@GIT_SERVER_ADDRESS:myproject.git
      git push origin master

I am a fan github.com and gitorious.com, but we needed something internal that would be simpler than gitorious to get up and running.

The next best thing I could find was gitosis which is very simple and straightforward.

However, gitosis lacked the user-friendly features I liked about github/gitorious. For example, how about a real simple way to list repos?

So, I decided to add “self-service” features to gitosis and call it gitosis-ng.  I want my users to be able to do all of these tasks on their own:

  • List available repos
  • Create new repos
  • Give permissions to other users on repos they control
  • Set metadata on repos (eg: URL, owner contact info, description)

So far I have implemented the first 2 features in this list and will be working on the remaining features as time permits.

Eventually I would love to find a way to allow users to self-register with gitosis-ng, but this could be challenging since gitosis-ng works entirely over SSH and relies on users having an SSH key registered with the server before they can execute commands.

gitosis-ng is available on github:  http://github.com/joemiller/gitosis-ng

Published at DZone with permission of Joe Miller, author and DZone MVB. (source)

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)