{"id":13626840,"url":"https://github.com/huoyijie/gitcode","last_synced_at":"2025-04-14T22:13:30.101Z","repository":{"id":93832534,"uuid":"605976023","full_name":"huoyijie/gitcode","owner":"huoyijie","description":"gitcode is a personal lightweight self-hosted git server written in Go","archived":false,"fork":false,"pushed_at":"2023-03-04T04:17:12.000Z","size":602,"stargazers_count":5,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-14T22:13:21.739Z","etag":null,"topics":["bootstrap","gin-gonic","git","gitserver","go-git","golang","markdown","vue"],"latest_commit_sha":null,"homepage":"https://huoyijie.cn:1024","language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/huoyijie.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2023-02-24T10:10:23.000Z","updated_at":"2025-01-03T02:19:39.000Z","dependencies_parsed_at":"2023-03-05T05:15:24.836Z","dependency_job_id":null,"html_url":"https://github.com/huoyijie/gitcode","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/huoyijie%2Fgitcode","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/huoyijie%2Fgitcode/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/huoyijie%2Fgitcode/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/huoyijie%2Fgitcode/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/huoyijie","download_url":"https://codeload.github.com/huoyijie/gitcode/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248968917,"owners_count":21191162,"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":["bootstrap","gin-gonic","git","gitserver","go-git","golang","markdown","vue"],"created_at":"2024-08-01T22:00:23.033Z","updated_at":"2025-04-14T22:13:30.076Z","avatar_url":"https://github.com/huoyijie.png","language":"HTML","funding_links":[],"categories":["Go"],"sub_categories":[],"readme":"# Gitcode\n\n## Introduction\n\n[gitcode](https://github.com/huoyijie/gitcode) is a personal lightweight self-hosted git server written in Go. It stands on top of git, go-git, and powered by Bootstrap, Vue, Docsify and Prismjs. It's about the same as gitweb now.\n\n[My personal gitcodes](https://huoyijie.cn:1024)\n\n## Features\n\n* Support organization\n\ne.g.: git clone `git@huoyijie.cn`:`go`/gitcode.git, gitcode.git repository stored in organization `go`\n\n* Support new repository\n* Support authorization by repository\n* Browse or clone authorized code repositories\n* Support markdown automatic rendering\n* Support code highlighting\n\n![Home](docs/images/gitcode-home.png)\n\n![Markdown](docs/images/gitcode-markdown.png)\n\n![Code highlights](docs/images/gitcode-highlights.png)\n\n## Prerequisites\n\n* Go 1.20+\n\n## Install\n\n```bash\n$ git@github.com:huoyijie/gitcode.git\n\n$ cd gitcode\n\n$ go install .\n```\n\n```bash\n$ gitcode -h\nUsage of gitcode:\n  -host string\n    \tthe host that server listen on (default \"127.0.0.1\")\n  -hostname string\n    \tthe host name of the server (default \"huoyijie.cn\")\n  -port int\n    \tthe port that server listen on (default 8000)\n  -repos string\n    \tthe director where repos store (default \"/home/git\")\n```\n\n## Run gitcode\n\n### server\n\nRun gitcode manually\n```bash\n# Listen on 127.0.0.1:8787\n$ gitcode -port 8787 -repos /home/git\n```\n\nRun gitcode as a service\n\nCreate a systemd config file `/etc/systemd/system/gitcode.service`\n```conf\n[Unit]\nDescription=Gitcode\n\n[Service]\nUser=git\nGroup=git\nType=idle\nEnvironment=\"GIN_MODE=release\"\nExecStart=/home/ubuntu/go/bin/gitcode -port 8787 -repos /home/git\nRestart=always\nKillMode=process\n\n[Install]\nWantedBy=multi-user.target\n```\n\nStart gitcode service\n```bash\n$ sudo systemctl daemon-reload\n$ sudo systemctl enable --now gitcode\n```\n\nView logs\n```bash\n$ systemctl -fu gitcode\n```\n\n### client\n\nAccess gitcode server through SSH tunnel\n```bash\n$ ssh -N -L 8787:127.0.0.1:8787 -o ServerAliveInterval=5 git@huoyijie.cn\n```\n\nOpen `http://127.0.0.1:8787/` with the browser\n\nIn order to safely access gitcode througth the public network, you can configure nginx reverse proxy and TLS.\n\ne.g.: [Demo](https://huoyijie.cn:1024)\n\n## Authorization (based on casbin)\n\nYou can take a look at examples directory.\n\n* RBAC model\n```conf\n[request_definition]\nr = sub, obj, act\n\n[policy_definition]\np = sub, obj, act\n\n[role_definition]\ng = _, _\n\n[policy_effect]\ne = some(where (p.eft == allow))\n\n[matchers]\nm = g(r.sub, p.sub) \u0026\u0026 r.obj == p.obj \u0026\u0026 r.act == p.act\n```\n\n* RBAC policy\n```csv\np, role_admin, efs, read\np, role_admin, efs, write\np, role_admin, huoyijie, read\np, role_admin, huoyijie, write\np, role_guest, huoyijie, read\ng, gitcode, role_admin\ng, guest, role_guest\n```\n\n## TODO\n\n* show binary files `done`\n* show submodules `done`\n* show breadcrumb `done`\n* ssh proxy/ssh clone `done`\n* render markdown/readme `done`\n* create new repo `done`\n* sign in/sign out/auth by role `done`\n\n## Future\n\n* code highlights, auto load script file\n* show commits (very slow)\n* show branchs/tags\n* search repo\n* search code\n* issues\n* pull request\n* code diff\n* merge request\n* hook and build docker image\n* publish with k8s","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhuoyijie%2Fgitcode","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhuoyijie%2Fgitcode","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhuoyijie%2Fgitcode/lists"}