Skip to content

Add Git support for containers #5

Closed

Description

@melvincarvalho

Summary

Enable containers to function as Git repositories, allowing users to:

  • git clone a container
  • git push changes back
  • Track version history of resources

Motivation

  1. Familiar workflow - Developers know Git; versioning pods becomes intuitive
  2. Offline editing - Clone pod locally, edit, push when ready
  3. Collaboration - Multiple users can branch/merge pod content
  4. Backup - Clone provides automatic backup
  5. Version history - Built-in audit trail for all changes

Prior Art

nosdav/server

Already implemented in nosdav using git http-backend:

QuitStore

QuitStore - "Quads in Git" - combines Git with RDF/SPARQL for versioned linked data.

Git HTTP Protocol

Implementation Approach

Simple: Shell out to git http-backend

Following nosdav's approach - no npm packages, just use Git's built-in CGI:

import { spawn } from 'child_process';

function handleGitRequest(request, reply) {
  const git = spawn('git', ['http-backend'], {
    env: {
      GIT_PROJECT_ROOT: '/path/to/pods',
      GIT_HTTP_EXPORT_ALL: '1',
      GIT_HTTP_RECEIVE_PACK: 'true',
      PATH_INFO: request.url,
      QUERY_STRING: request.query,
      REQUEST_METHOD: request.method,
      // ... other CGI env vars
    }
  });
  
  request.raw.pipe(git.stdin);
  git.stdout.pipe(reply.raw);
}

Detection

Git requests identified by:

  • */info/refs?service=git-upload-pack
  • */git-upload-pack
  • */git-receive-pack
  • URLs ending in .git

Authorization

Use existing WAC - check acl:Read for clone, acl:Write for push.

Questions

  1. Auto-init: Create .git when container is created, or on first clone attempt?
  2. Bare vs regular: Bare repos are more efficient for servers
  3. RDF awareness: Should commits trigger any RDF-specific logic?
  4. Submodules: Support .git suffix on any container path?

Files to Modify

File Change
src/handlers/git.js NEW - Git HTTP backend handler
src/index.js Add git route detection
src/handlers/container.js Optional: init git on container creation

Effort Estimate

~3-4 hours - mostly porting nosdav's working implementation.

References

Activity

  1. melvincarvalho commented on Dec 27, 2025

    @melvincarvalho
    ContributorAuthor

    Formalized as JIP-0002

    This proposal has been written up as JIP-0002 in the JSS Improvement Proposals repository:

    https://github.com/JavaScriptSolidServer/jips/blob/main/jip-0002.md

    Key points:

    • Uses git http-backend (no npm packages needed)
    • WAC authorization for read/write access
    • Based on working nosdav implementation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions