{"id":14384542,"url":"https://github.com/adobe/git-server","last_synced_at":"2025-09-27T05:31:36.217Z","repository":{"id":41348136,"uuid":"139856700","full_name":"adobe/git-server","owner":"adobe","description":"A GitHub Protocol \u0026 API emulation","archived":true,"fork":false,"pushed_at":"2021-09-21T07:12:03.000Z","size":4664,"stargazers_count":79,"open_issues_count":0,"forks_count":29,"subscribers_count":40,"default_branch":"main","last_synced_at":"2025-01-04T20:41:45.384Z","etag":null,"topics":["git","git-protocol","github","github-api","helix"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/adobe.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.txt","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-07-05T13:53:05.000Z","updated_at":"2024-10-12T23:37:35.000Z","dependencies_parsed_at":"2022-09-19T04:41:29.225Z","dependency_job_id":null,"html_url":"https://github.com/adobe/git-server","commit_stats":null,"previous_names":[],"tags_count":82,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adobe%2Fgit-server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adobe%2Fgit-server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adobe%2Fgit-server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adobe%2Fgit-server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/adobe","download_url":"https://codeload.github.com/adobe/git-server/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":234278389,"owners_count":18807223,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["git","git-protocol","github","github-api","helix"],"created_at":"2024-08-28T18:01:27.724Z","updated_at":"2025-09-27T05:31:35.579Z","avatar_url":"https://github.com/adobe.png","language":"JavaScript","readme":"\u003ch1\u003egit-server\u003c/h1\u003e\n\nA GitHub Protocol \u0026 API emulation.\n\n\u003c!-- TOC --\u003e\n- [Status](#status)\n- [Description](#description)\n- [Installation](#installation)\n- [Getting started](#getting-started)\n  - [1. Create a local Git repository](#1-create-a-local-git-repository)\n  - [2. Start server](#2-start-server)\n  - [3. Fetch raw content of file in Git repo over http](#3-fetch-raw-content-of-file-in-git-repo-over-http)\n- [Git Protocols and APIs](#git-protocols-and-apis)\n  - [1. Git Raw Protocol](#1-git-raw-protocol)\n  - [2. Git HTTP Transfer Protocols](#2-git-http-transfer-protocols)\n    - [`git push` support](#git-push-support)\n  - [3. GitHub API v3](#3-github-api-v3)\n  - [4. GitHub-like Web Server](#4-github-like-web-server)\n\u003c!-- /TOC --\u003e\n\n---\n## Status\n\n[![codecov](https://img.shields.io/codecov/c/github/adobe/git-server.svg)](https://codecov.io/gh/adobe/git-server)\n[![CircleCI](https://img.shields.io/circleci/project/github/adobe/git-server.svg)](https://circleci.com/gh/adobe/git-server)\n[![GitHub license](https://img.shields.io/github/license/adobe/git-server.svg)](https://github.com/adobe/git-server/blob/main/LICENSE.txt)\n[![GitHub issues](https://img.shields.io/github/issues/adobe/git-server.svg)](https://github.com/adobe/git-server/issues)\n[![Renovate enabled](https://img.shields.io/badge/renovate-enabled-brightgreen.svg)](https://renovatebot.com/)\n[![Language grade: JavaScript](https://img.shields.io/lgtm/grade/javascript/g/adobe/git-server.svg?logo=lgtm\u0026logoWidth=18)](https://lgtm.com/projects/g/adobe/git-server/context:javascript)\n[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)\n\n## Description\n\n`git-server` serves a hierarchy of local Git repositories to Git clients accessing the repository over `http://` and `https://` protocol.\n\n`git-server` expects the local Git repositories (either cloned or created with `git init`) to be organized as follows in the local file system:\n\n```ascii\n\u003crepos_root_dir\u003e/\n├── \u003cowner_1\u003e/\n│   └── \u003crepo_1\u003e\n│   └── \u003crepo_2\u003e\n├── \u003cowner_2\u003e/\n│   └── \u003crepo_1\u003e\n│   └── \u003crepo_2\u003e\n```\n\nAlternatively, a virtual repository mapping allows to 'mount' repositories independent of their location in the file system into a `\u003cowner\u003e/\u003crepo\u003e` hierarchy. A configuration example:\n\n```js\n  virtualRepos: {\n    owner1: {\n      repo1: {\n        path: './repo1',\n      },\n    },\n    owner2: {\n      repo2: {\n        path: '/repos/repo2',\n      },\n    },\n  },\n```\n\nRepositories exposed via `git-server` can be used just like any repository hosted on GitHub, i.e. you can clone them and push changes to.\nThe repository contents can be accessed with the same url patterns you would use to request files managed on GitHub.\n\nThe following protocols and APIs are currently supported:\n\n* [Git Raw protocol](#1-git-raw-protocol)\n* [Git HTTP Transfer Protocols](#2-git-http-transfer-protocols)\n* [GitHub API v3](#3-github-api-v3)\n\n## Installation\n\n```bash\ncd \u003ccheckout dir\u003e\nnpm install\n```\n\n## Getting started\n\n`git-server` is configured via the `config.js` file which is expected to exist in the current working directory. Here's the default configuration:\n\n```javascript\n{\n  appTitle: 'Helix Git Server',\n  repoRoot: './repos',\n  // repository mapping. allows to 'mount' repositories outside the 'repoRoot' structure.\n  virtualRepos: {\n    demoOwner: {\n      demoRepo: {\n        path: './virtual/example',\n      },\n    },\n  },\n  listen: {\n    http: {\n      port: 5000,\n      host: '0.0.0.0',\n    },\n    /*\n    // https is optional\n    https: {\n      // cert: if no file is specfied a selfsigned certificate will be generated on-the-fly\n      // cert: './localhost.crt',\n      // key: if no file is specfied a key will be generated on-the-fly\n      // key: './localhost.key',\n      port: 5443,\n      host: '0.0.0.0',\n    },\n    */\n  },\n  subdomainMapping: {\n    // if enabled, \u003csubdomain\u003e.\u003cbaseDomain\u003e/foo/bar/baz will be\n    // resolved/mapped to 127.0.0.1/\u003csubdomain\u003e/foo/bar/baz\n    enable: true,\n    baseDomains: [\n      // some wildcarded DNS domains resolving to 127.0.0.1\n      'localtest.me',\n      'lvh.me',\n      'vcap.me',\n      'lacolhost.com',\n    ],\n  },\n  logs: {\n    level: 'info', // fatal, error, warn, info, verbose, debug, trace\n    logsDir: './logs',\n    reqLogFormat: 'short', // used for morgan (request logging)\n  },\n}\n```\n\n`git-server` uses [helix-log](https://github.com/adobe/helix-log) for logging. The log level (`fatal`, `error`, `warn`, `info`, `verbose`, `debug`, `trace`) can be set via the `logs.level` property in the config (see above). For more information please refer to the [helix-log](https://github.com/adobe/helix-log) project.\n\n### 1. Create a local Git repository\n\n```bash\ncd ./repos\n# create org\nmkdir helix \u0026\u0026 cd helix\n# initialize new git repo\nmkdir test \u0026\u0026 cd test \u0026\u0026 git init\n# allow to remotely push to this repo\ngit config receive.denyCurrentBranch updateInstead\n# add a README.md\necho '# test repo'\u003eREADME.md\ngit add . \u0026\u0026 git commit -m '1st commit'\ncd ../../..\n```\n\n### 2. Start server\n\n```bash\nnpm start\n```\n\n### 3. Fetch raw content of file in Git repo over http\n\n```bash\ncurl http://localhost:5000/raw/helix/test/main/README.md\n```\n\n## Git Protocols and APIs\n\n### 1. Git Raw Protocol\n\nServing content of a file in a git repo.\n\nThe requested file is specified by:\n\n* `{owner}`: GitHub organization or user\n* `{repo}`: repository name\n* `{ref}`: Git reference\n  * branch name (e.g. `main`)\n  * tag name (e.g. `v1.0`)\n  * (full or shorthand) commit id (e.g. `7aeff3d`)\n\nGitHub URLs:\n\n* `https://raw.githubusercontent.com/{owner}/{repo}/{ref}/path/to/file`\n* `https://github.com/{owner}/{repo}/raw/{ref}/path/to/file`\n\nLocal `git-server` URLs:\n\n* `http://localhost:{port}/raw/{owner}/{repo}/{ref}/path/to/file`\n* `http://localhost:{port}/{owner}/{repo}/raw/{ref}/path/to/file`\n* `http://raw.localtest.me:{port}/{owner}/{repo}/{ref}/path/to/file` (using wildcarded DNS domain resolving to `127.0.0.1`)\n\nRemote examples:\n\n* `https://raw.githubusercontent.com/adobe/git-server/main/README.md`\n* `https://github.com/adobe/git-server/raw/main/README.md`\n\nLocal examples:\n\n* `http://raw.localtest.me:5000/adobe/git-server/main/README.md`\n* `http://localhost:5000/adobe/git-server/raw/main/README.md`\n* `http://localhost:5000/raw/adobe/git-server/main/README.md`\n\n`raw.githubusercontent.com` serves certain file types (e.g. JavaScript, CSS, HTML) with incorrect `Content-Type: text/plain` header. 3rd party solutions like `rawgit.com` address this issue. `git-server` serves files with correct content type.\n\n### 2. Git HTTP Transfer Protocols\n\nSupport for `git clone, push, fetch`\n\nDocumentation:\n\n* [10.6 Git Internals - Transfer Protocols](https://git-scm.com/book/en/v2/Git-Internals-Transfer-Protocols)\n* [Git HTTP transport protocol documentation](https://github.com/git/git/blob/master/Documentation/technical/http-protocol.txt)\n\n#### `git push` support\n\nThe served local repo needs to be either a *bare* repo (`git clone --bare` or `git init --bare`) or the following option needs to be set:\n\n```bash\ngit config receive.denyCurrentBranch updateInstead\n```\n\n[more information](https://stackoverflow.com/questions/804545/what-is-this-git-warning-message-when-pushing-changes-to-a-remote-repository/28262104#28262104)\n\n### 3. GitHub API v3\n\nDocumentation: [GitHub API v3](https://developer.github.com/v3/)\n\nGitHub Endpoint: `https://api.github.com/`\n\nLocal endpoint: `http://localhost:{port}/api` or e.g. `http://api.localtest.me:{port}` (using wildcarded DNS domain resolving to `127.0.0.1`)\n\nOnly a small subset of the GitHub API will be supported:\n\n* [Get contents](https://developer.github.com/v3/repos/contents/#get-contents)\n\n  _Note:_ The GitHub implementation supports files up to 1 megabyte in size.\n\n* [Get blob](https://developer.github.com/v3/git/blobs/#get-a-blob)\n\n  _Note:_ The GitHub implementation supports blobs up to 100 megabytes in size.\n\n* [Get tree](https://developer.github.com/v3/git/trees/#get-a-tree-recursively)\n\n* [Get commits](https://developer.github.com/v3/repos/commits/#list-commits-on-a-repository)\n\n* [Get archive link](https://developer.github.com/v3/repos/contents/#get-archive-link)\n\n  _Note:_  This method returns a `302` to a URL to download a tarball or zipball archive for a repository. `git-server` also supports an unofficial `https://codeload.github.com` endpoint that is not rate limited and that doesn't redirect:\n\n  * `https://codeload.github.com/{owner}/{repo}/[zip|tar.gz]/main`\n\n  Related issue/discussion: [#5 Support codeload.github.com](https://github.com/adobe/git-server/issues/5#issuecomment-403072428)\n\nLocal examples:\n\n* `http://api.localtest.me:5000/repos/adobe/git-server/contents/README.md?ref=main`\n* `http://api.localtest.me:5000/repos/adobe/project-helix/git/blobs/bf13fe66cbee379db6a3e4ebf0300b8bbc0f01b7`\n* `http://localhost:5000/api/repos/adobe/git-server/contents/README.md?ref=main`\n* `http://localhost:5000/api/repos/adobe/project-helix/git/blobs/bf13fe66cbee379db6a3e4ebf0300b8bbc0f01b7`\n\n### 4. GitHub-like Web Server\n\n_(not yet implemented)_\n\nEndpoint: `https://github.com/`\n\ne.g.\n\n  `https://github.com/{owner}/{repo}`,\n  `https://github.com/{owner}/{repo}/blob/{branch}/path/to/file`\n","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadobe%2Fgit-server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fadobe%2Fgit-server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadobe%2Fgit-server/lists"}