go-git-dir: simple git hosting with a built-in SSH server
This project was inspired by gitolite, but also includes a built-in ssh server and some additional flexability. It is not considered stable, but should be usable enough to experiment with.
The main goal of this project is to enable simple git hosting when a full solution like Bitbucket, Github, Gitlab, Gitea, etc is not needed. It should require no additional resources, other than the directory it is pointed at, the running server, and a git installation.
Thankfully because all the repos are simply stored as bare git repositories, it should be fairly simple to migrate to or from other git hosting solutions.
- Go 1.13
- libgit2 0.28
- libgit2 0.28
From the root of the source tree, run:
This will create a binary called go-git-dir.
There are a number of environment variables which can be used to configure your go-git-dir instance.
The following are required:
GITDIR_BASE_DIR- A directory to store all repositories in. This folder must exist when the service starts up.
The following are optional:
The runtime config is stored in the "admin" repository. It can be cloned and modified by any admin on the server. In it you can specify groups (groupings of users for config or convenience reasons), repos, and orgs (groupings of repos managed by a person).
Additionally, there are a number of options that can be specified in this file which change the behavior of the server.
user_repos- allow users to have repos located at ~username/repo-name
There are a number of additional options in the sample config but they have not been implemented yet.
Simply run the built binary with
set and start using it!
On first run, go-git-dir will push a commit to the admin repo with a sample config as well as generated server ssh keys. These can be updated at any time (even at runtime) but if the server restarts and the keys cannot be loaded, they will be re-generated.
Note that you will need to manually clone the admin repository (at
) to add a user as a .yml file in the users dir
and define the admins group before things work as expected.
Example user file:
keys: - ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIIdmFwaB4lwmogg7ggFE8M45Zywx1W3T7dGktY563FM belak@laptop
Currently, if anyone has write access to a repo location, a repo will be auto-created on the first push there.
- ssh/scp 自动连接使用技巧
- Pwning your (web)server and network the easy way - or why exposing ~/.ssh/ is a bad idea
- ssh的高级用法 - ProxyCommand
- 实战 Git 分支策略
- git shallow clone 的一个问题
- Linux / Unix desktop fun: gti get jeep/car when you mistype git
- The right way to email a git repository
- TIL — git switch & git restore
- JAVA 使用jgit管理git仓库
- LWN: "git request-pull"里的混乱diffstat信息
- git clone下代码window与unix换行问题
- go-git-dir: simple git hosting with a built-in SSH server