{"id":16021114,"url":"https://github.com/cirocosta/git-serve","last_synced_at":"2026-02-28T04:32:48.952Z","repository":{"id":40941021,"uuid":"421020535","full_name":"cirocosta/git-serve","owner":"cirocosta","description":"ssh/http git servers on the fly: `kubectl create gitserver foo`","archived":false,"fork":false,"pushed_at":"2022-06-23T12:37:06.000Z","size":176,"stargazers_count":0,"open_issues_count":7,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-10-30T15:42:52.457Z","etag":null,"topics":["git","kubernetes"],"latest_commit_sha":null,"homepage":"","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/cirocosta.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":"2021-10-25T12:46:56.000Z","updated_at":"2021-11-04T10:55:46.000Z","dependencies_parsed_at":"2022-09-24T00:20:40.610Z","dependency_job_id":null,"html_url":"https://github.com/cirocosta/git-serve","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/cirocosta/git-serve","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cirocosta%2Fgit-serve","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cirocosta%2Fgit-serve/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cirocosta%2Fgit-serve/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cirocosta%2Fgit-serve/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cirocosta","download_url":"https://codeload.github.com/cirocosta/git-serve/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cirocosta%2Fgit-serve/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29924733,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-27T19:37:42.220Z","status":"online","status_checked_at":"2026-02-28T02:00:07.010Z","response_time":90,"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","kubernetes"],"created_at":"2024-10-08T18:01:43.526Z","updated_at":"2026-02-28T04:32:48.920Z","avatar_url":"https://github.com/cirocosta.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# git-serve\n\na toy git server with that lets you clone/push any repositories you want.\n\n- [usage](#usage)\n  - [cli](#cli)\n    - [no auth](#no-auth)\n    - [with auth](#with-auth)\n  - [kubernetes](#kubernetes)\n    - [spec](#spec)\n- [license](#license)\n\n## usage\n\n`git-serve` can be used either as a CLI (like, `git serve [args]`), or as an\nextension to kubernetes that lets you provision git servers inside a cluster.\n\n\n### cli\n\n```console\n$ git-serve --help\n\nUsage of git-serve:\n  -data-dir string\n        directory where repositories will be stored (default \"/tmp/git-serve\")\n  -git string\n        absolute path to git executable (default \"/usr/bin/git\")\n  -http-bind-addr string\n        address to bind the http server to (default \":8080\")\n  -http-no-auth\n        disable default use of basic auth for http\n  -http-password string\n        password (default \"admin\")\n  -http-username string\n        username (default \"admin\")\n  -ssh-authorized-keys string\n        path to public keys to authorized (ssh format)\n  -ssh-bind-addr string\n        address to bind the ssh server to (default \":2222\")\n  -ssh-host-key string\n        path to private key to use for the ssh server\n  -ssh-no-auth\n        disable default use of public key auth for ssh\n  -v    turn verbose logs on/off\n```\n\nps.: any of the flags above can be set via environment variables prefixed with\n`GIT_SERVE_`, for instance, to se `-http-password`, use\n`GIT_SERVE_HTTP_PASSWORD`.\n\n\n#### no auth\n\nby default, `git-serve` expects to serve repositories over SSH and HTTP with\nauth. to disable that, make use of the `*-no-auth` flags, for instance:\n\n```bash\ngit-serve -http-no-auth -ssh-no-auth\n```\n\nwhich would let you clone/push/pull with no need for providing any credentials\nat all:\n\n```\ngit clone ssh://localhost:2222/foo.git .\ngit clone http://localhost:2222/foo.git .\n```\n\nnote: by default (i.e., unless overwritten by `-ssh-host-key`), the SSH\nserver's public key that is used has the following fingerprint:\n\n```\nSHA256:PJo73EJabnFPeCNm1vssGMLsJSv7I9LztZrTwQOIdb8.\n```\n\n\n#### with auth\n\nauthn and authz is configured independently via transport-specific flags:\n\n- for http: `-http-username` and `-http-password` configure, correspondingly,\n  the username and password that must be provided via basic auth\n\n- for ssh: `-ssh-authorized-keys` configured the set of client public keys that\n  the server authorizes. note that you can also configure the server's keys via\n  `-ssh-host-key`.\n\n\nexample:\n\n1. generate a strong password for http's basic auth:\n\n```console\n$ gpg --gen-random --armor 0 24 | tee password.txt\nlJnhFm7EKVYEOovPbq7+x2J5DKeQr6u7\n```\n\n2. generate both server and client SSH keys\n\n```bash\nfor who in server client; do\n  ssh-keygen -b 4096 -t rsa -f $who -q -N \"\" -C gitserve\ndone\n```\n\nto check out the fingerprint of the server pub key that has been generated\n(will be added to your `~/.ssh/known_hosts` in the first connection attempt):\n\n```console\n$ ssh-keygen -lf ./server.pub\n4096 SHA256:y8DKXGUYdySAFGnRzbPUmFaCLbDbWOa10ieOdkF4aZg gitserve (RSA)\n```\n\n\n3. start git-serve pointing at those\n\n\n```console\ngit-serve \\\n  -http-username=admin \\\n  -http-password=$(cat password.txt) \\\n  -ssh-host-key ./server \\\n  -ssh-authorized-keys ./client.pub\n```\n\nps.: by default, ports are: `http=8080,ssh=2222`.\n\n\n### kubernetes\n\n`git-serve` can also be used as an extension to kubernetes to provision servers\non-demand.\n\nto install the custom resource definition:\n\n```\nkubectl apply -f https://github.com/cirocosta/git-serve/releases/latest/download/git-serve.yaml\n```\n\nonce installed, you should have a new kubernetes kind: GitServer.\n\n```console\n$ kubectl explain gitserver\nKIND:     GitServer\nVERSION:  ops.tips/v1alpha1\n...\n```\n\n\n#### spec\n\n```yaml\n# a GIT server that makes use of every auth\n# feature that there is: for `http` and `ssh`.\n#\napiVersion: ops.tips/v1alpha1\nkind: GitServer\nmetadata:\n  name: git-server\nspec:\n  # image to base the pods of\n  #\n  image: cirocosta/git-serve\n\n  http:\n    auth:\n      # grab username from a specific field in a\n      # secret.\n      #\n      username:\n        valueFrom:\n          secretKeyRef:\n            name: secret\n            key: username\n\n      # grab password from a specific field in a\n      # secret.\n      #\n      password:\n        valueFrom:\n          secretKeyRef:\n            name: secret\n            key: password\n  ssh:\n    auth:\n      # grab clients pub keys from a specific\n      # field in a secret.\n      #\n      authorizedKeys:\n        valueFrom:\n          secretKeyRef:\n            name: secret\n            key: ssh-authorizedkeys\n\n      # grab the server's private key from a\n      # specific field in a secret.\n      #\n      hostKey:\n        valueFrom:\n          secretKeyRef:\n            name: secret\n            key: ssh-privatekey\nstatus:\n  observedGeneration: \u003cint\u003e\n  conditions:\n    - type: Ready\n      status: True\n```\n\n\n## license\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcirocosta%2Fgit-serve","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcirocosta%2Fgit-serve","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcirocosta%2Fgit-serve/lists"}