Over a million developers have joined DZone.
Platinum Partner

Gitosis-ng: Simple, Self-service Git Repositories

· DevOps Zone

The DevOps Zone is brought to you by DZone in partnership with Hewlett Packard Enterprise DevOps. Learn where you are in your DevOps journey by taking the HPE/Forrester benchmarking tool.

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

The DevOps Zone is brought to you in partnership with Hewlett Packard Enterprise.  Download Through the DevOps Looking Glass: Learnings from HP's Own Transformation Initiative to get valuable best practices and “lessons learned” straight from the HP IT team to help you start or progress along your own DevOps Journey.

Topics:

Published at DZone with permission of Joe Miller , DZone MVB .

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}