SJRK-46: Research REST API for Git repositories

Metadata

Source
SJRK-46
Type
Task
Priority
Major
Status
Closed
Resolution
Done
Assignee
Giovanni Tirloni
Reporter
Giovanni Tirloni
Created
2017-12-20T16:40:27.420-0500
Updated
2018-02-21T08:53:20.351-0500
Versions
N/A
Fixed Versions
N/A
Component
N/A

Description

Document what's available to expose Git repositories over a REST API.

Comments

  • Giovanni Tirloni commented 2018-01-08T13:43:20.924-0500

    My understanding is that Git can work over either HTTP or SSH. This is described in the Transfer Protocol page. The steps for configure a server are detailed in the Pro Git book.

    To access a repository and manipulate its contents from Javascript, JS-Git is a pure Javascript implementation.

    There are modules available (node-git) but they rely on the Git binary being available.

    Others, like the Javascript bindings for libgit2 called nodegit need C/C++ native code to work. That should be okay in a Node.js process but it's not suitable for a pure browser implementation (if that's our target but I'm not sure).

    None of what was mentioned above offers a REST API. After searching for a while, I could find only one implementating of a REST API for dealing with Git data: hulu/restfulgit. It's not seen a commit in 3 years though and it's coded in Python. I could not find another REST interface on top of git's send-pack and receive-pack processes (which are used in the Smart HTTP transport mode for read-write access).

    I have only been able to find maintained REST APIs for managing Git repository, that is, creating repositories, branches, tags and all sorts of administrative changes except actually manipulating the data (committing code).

    All major public Git services offer some sort of REST API to manage repositories:

    Gogs, an open source self-hosted Git service, is working on implementing a REST API but it doesn't seem complete at the moment (see here. It's worth noting, GitLab is open source too.

    A Node.js application could use something like node-git to work with an existing repository and some of the vendor-specific APIs to create branches and tags (or even new repositories) and retrieve all sorts of data about the repository.

    @@Gregor Moss @@Alan Harnum please let me know if you think that's enough information for next steps.