githttp

package
v0.0.0-...-c7691f4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 15, 2026 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Overview

Package githttp serves the Git Smart HTTP protocol backed by system git-http-backend. Routes:

GET  /{owner}/{repo}.git/info/refs?service=git-{upload,receive}-pack
POST /{owner}/{repo}.git/git-upload-pack
POST /{owner}/{repo}.git/git-receive-pack

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

type Handler struct {
	Svc *service.Service
	// contains filtered or unexported fields
}

Handler wraps the gitstore for HTTP git protocol serving.

func New

func New(store Store, svc *service.Service) *Handler

New creates a new git HTTP handler.

func (*Handler) InfoRefs

func (h *Handler) InfoRefs(w http.ResponseWriter, r *http.Request)

InfoRefs handles GET /{owner}/{repo}.git/info/refs?service=git-*

func (*Handler) ReceivePack

func (h *Handler) ReceivePack(w http.ResponseWriter, r *http.Request)

ReceivePack handles POST /{owner}/{repo}.git/git-receive-pack (push)

func (*Handler) UploadPack

func (h *Handler) UploadPack(w http.ResponseWriter, r *http.Request)

UploadPack handles POST /{owner}/{repo}.git/git-upload-pack (clone/fetch)

type Store

type Store interface {
	Exists(ctx context.Context, fullName string) bool
	Init(ctx context.Context, fullName, defaultBranch string, seed bool) error
	GetRepoPath(ctx context.Context, fullName string) (string, error)
	RepoRoot(ctx context.Context) (string, error)
	WithRepoLock(ctx context.Context, fullName string, fn func() error) error
}

Store defines the git storage operations required by the HTTP handler.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL