Over a million developers have joined DZone.

Gitosis-ng: Simple, Self-service Git Repositories

· DevOps Zone

The DevOps zone is brought to you in partnership with Sonatype Nexus. The Nexus suite helps scale your DevOps delivery with continuous component intelligence integrated into development tools, including Eclipse, IntelliJ, Jenkins, Bamboo, SonarQube and more. Schedule a demo today

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 Sonatype Nexus. Use the Nexus Suite to automate your software supply chain and ensure you're using the highest quality open source components at every step of the development lifecycle. Get Nexus today

Topics:

Published at DZone with permission of Joe Miller, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

SEE AN EXAMPLE
Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.
Subscribe

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

{{ parent.tldr }}

{{ parent.urlSource.name }}