{"id":26493565,"url":"https://github.com/nulab/go-git-http-xfer","last_synced_at":"2025-10-12T08:16:31.999Z","repository":{"id":52288971,"uuid":"102366860","full_name":"nulab/go-git-http-xfer","owner":"nulab","description":"Implements Git HTTP Transport.","archived":false,"fork":false,"pushed_at":"2021-05-25T06:43:14.000Z","size":104,"stargazers_count":15,"open_issues_count":1,"forks_count":5,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-08-14T02:43:47.992Z","etag":null,"topics":["git","golang","httpd"],"latest_commit_sha":null,"homepage":"https://git-scm.com/book/en/v2/Git-Internals-Transfer-Protocols","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nulab.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-09-04T13:52:54.000Z","updated_at":"2024-03-03T16:56:38.000Z","dependencies_parsed_at":"2022-09-07T05:13:02.603Z","dependency_job_id":null,"html_url":"https://github.com/nulab/go-git-http-xfer","commit_stats":null,"previous_names":["vvatanabe/go-git-http-transfer"],"tags_count":19,"template":false,"template_full_name":null,"purl":"pkg:github/nulab/go-git-http-xfer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nulab%2Fgo-git-http-xfer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nulab%2Fgo-git-http-xfer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nulab%2Fgo-git-http-xfer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nulab%2Fgo-git-http-xfer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nulab","download_url":"https://codeload.github.com/nulab/go-git-http-xfer/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nulab%2Fgo-git-http-xfer/sbom","scorecard":{"id":698277,"data":{"date":"2025-08-11","repo":{"name":"github.com/nulab/go-git-http-xfer","commit":"2c6e84059ee0649e691f39ec0a83f72bbb62e66e"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.4,"checks":[{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Code-Review","score":0,"reason":"Found 0/16 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":0,"reason":"license file not detected","details":["Warn: project does not have a license file"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: containerImage not pinned by hash: Dockerfile:2: pin your Docker image by updating golang:1.15 to golang:1.15@sha256:ea080cc817b02a946461d42c02891bf750e3916c52f7ea8187bccde8f312b59f","Info:   0 out of   1 containerImage dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 27 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-22T04:23:39.046Z","repository_id":52288971,"created_at":"2025-08-22T04:23:39.046Z","updated_at":"2025-08-22T04:23:39.046Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279010803,"owners_count":26084807,"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","status":"online","status_checked_at":"2025-10-12T02:00:06.719Z","response_time":53,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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","golang","httpd"],"created_at":"2025-03-20T09:55:45.259Z","updated_at":"2025-10-12T08:16:31.979Z","avatar_url":"https://github.com/nulab.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# go-git-http-xfer [![Build Status](https://travis-ci.com/nulab/go-git-http-xfer.svg?branch=master)](https://travis-ci.com/nulab/go-git-http-xfer) [![Coverage Status](https://coveralls.io/repos/github/nulab/go-git-http-xfer/badge.svg?branch=master)](https://coveralls.io/github/nulab/go-git-http-xfer?branch=master)\n\nImplements Git HTTP Transport.\n\n## Support Protocol\n\n* The Smart Protocol\n* The Dumb Protocol\n\n## Requires\n\n* Go 1.7+\n\n## Quickly Trial\n\nLet's clone this repository and execute the following commands.\n\n```` zsh\n# docker build\n$ docker build -t go-git-http-xfer .\n\n# test\n$ docker run --rm -v $PWD:/go/src/github.com/nulab/go-git-http-xfer go-git-http-xfer \\\n    bash -c \"gotestcover -v -covermode=count -coverprofile=coverage.out ./...\"\n\n# run server\n$ docker run -it --rm -v $PWD:/go/src/github.com/nulab/go-git-http-xfer -p 5050:5050 go-git-http-xfer \\\n    bash -c \"go run ./example/main.go -p 5050\"\n\n# in your local machine\n$ git clone http://localhost:5050/example.git\n````\n\n## Installation\n\nThis package can be installed with the go get command:\n\n``` zsh\n$ go get github.com/nulab/go-git-http-xfer\n```\n\n## Usage\n\nBasic\n``` go\npackage main\n\nimport (\n\t\"log\"\n\t\"net/http\"\n\n\t\"github.com/nulab/go-git-http-xfer/githttpxfer\"\n)\n\nfunc main() {\n\t\n\tghx, err := githttpxfer.New(\"/data/git\", \"/usr/bin/git\")\n\tif err != nil {\n\t\tlog.Fatalf(\"GitHTTPXfer instance could not be created. %s\", err.Error())\n\t\treturn\n\t}\n\t\n\tif err := http.ListenAndServe(\":5050\", ghx); err != nil {\n\t\tlog.Fatal(\"ListenAndServe: \", err)\n\t}\n}\n```\nYou can add optional parameters to constructor function.\n* `DisableUploadPack` : Disable `git upload-pack` command.\n* `DisableReceivePack`: Disable `git receive-pack` command.\n* `WithoutDumbProto`  : Without `dumb protocol` handling.\n* `WithoutDumbProtoExceptHead`  : Without `dumb protocol` except `head` handling.\n```go\n\tghx, err := githttpxfer.New(\n\t\t\"/data/git\",\n\t\t\"/usr/bin/git\",\n\t\tgithttpxfer.DisableUploadPack(),\n\t\tgithttpxfer.DisableReceivePack(),\n\t\tgithttpxfer.WithoutDumbProto(),\n\t)\n```\nYou can add some custom route.\n``` go\nfunc main() {\n\n\tghx, err := githttpxfer.New(\"/data/git\", \"/usr/bin/git\")\n\tif err != nil {\n\t\tlog.Fatalf(\"GitHTTPXfer instance could not be created. %s\", err.Error())\n\t\treturn\n\t}\n\n\t// You can add some custom route.\n\tghx.Router.Add(githttpxfer.NewRoute(\n\t\thttp.MethodGet,\n\t\tfunc (u *url.URL) *Match {\n\t\t\tsuffix := \"/hello\"\n\t\t\tif !strings.HasSuffix(u.Path, suffix) {\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\trepoPath := strings.Replace(u.Path, suffix, \"\", 1)\n\t\t\tfilePath := strings.Replace(u.Path, repoPath+\"/\", \"\", 1)\n\t\t\treturn \u0026Match{repoPath, filePath}\n\t\t},\n\t\tfunc(ctx githttpxfer.Context) {\n\t\t\tresp, req := ctx.Response(), ctx.Request()\n\t\t\trp, fp := ctx.RepoPath(), ctx.FilePath()\n\t\t\tfmt.Fprintf(resp.Writer,\n\t\t\t\t\"Hi there. URI: %s, RepoPath: %s, FilePath: %s\",\n\t\t\t\treq.URL.RequestURI(), rp, fp)\n\t\t},\n\t))\n\t\n\tif err := http.ListenAndServe(\":5050\", ghx); err != nil {\n\t\tlog.Fatal(\"ListenAndServe: \", err)\n\t}\n}\n```\nYou can add some middleware.\n``` go\nfunc main() {\n\t\n\tghx, err := githttpxfer.New(\"/data/git\", \"/usr/bin/git\")\n\tif err != nil {\n\t\tlog.Fatalf(\"GitHTTPXfer instance could not be created. %s\", err.Error())\n\t\treturn\n\t}\n\t\n\thandler := Logging(ghx)\n\t\n\tif err := http.ListenAndServe(\":5050\", ghx); err != nil {\n\t\tlog.Fatal(\"ListenAndServe: \", err)\n\t}\n}\n\nfunc Logging(next http.Handler) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tt1 := time.Now()\n\t\tnext.ServeHTTP(w, r)\n\t\tt2 := time.Now()\n\t\tlog.Printf(\"[%s] %q %v\\n\", r.Method, r.URL.String(), t2.Sub(t1))\n\t})\n}\n```\nYou can add some addon handler. (git archive)\n``` go\nimport (\n\t\"github.com/nulab/go-git-http-xfer/addon/handler/archive\"\n)\n\nfunc main() {\n\tghx, err := githttpxfer.New(\"/data/git\", \"/usr/bin/git\")\n\tif err != nil {\n\t\tlog.Fatalf(\"GitHTTPXfer instance could not be created. %s\", err.Error())\n\t\treturn\n\t}\n\t\n\tghx.Router.Add(githttpxfer.NewRoute(\n\t\tarchive.Method,\n\t\tarchive.Pattern,\n\t\tarchive.New(ghx).Archive,\n\t))\n\t\n\tif err := http.ListenAndServe(\":5050\", ghx); err != nil {\n\t\tlog.Fatal(\"ListenAndServe: \", err)\n\t}\n}\n\n```\n\n## Reference\n\n- [Git Internals - Transfer Protocols](http://www.opensource.org/licenses/mit-license.php)\n- [grackorg/grack](https://github.com/grackorg/grack)\n- [dragon3/Plack-App-GitSmartHttp](https://github.com/dragon3/Plack-App-GitSmartHttp)\n\n## Bugs and Feedback\n\nFor bugs, questions and discussions please use the Github Issues.\n\n## License\n\n[MIT License](http://www.opensource.org/licenses/mit-license.php)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnulab%2Fgo-git-http-xfer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnulab%2Fgo-git-http-xfer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnulab%2Fgo-git-http-xfer/lists"}