通过 LAN 共享 Git 存储库的最佳简单方法

Best Simple Way to Share a Git Repository over LAN

我需要通过 LAN 与我的同事共享一个大型 git 存储库(总共 >3GB,.git 文件夹约为 1.1GB)作为 Windows 共享文件夹。但他们发现克隆和 push/pull 真的很慢——即在克隆开始前等待约 30 分钟,并在任何 push/pull 开始前暂停约 5 分钟。

是否每个人都知道有什么方法可以减少延迟或共享 repo 的更好方法吗?

P.S。我不想设置Gitlab,因为它太复杂了。

由于您的 git 存储库非常大,您可以 将整个 git 存储库或部分提交捆绑在您的同事之间共享

捆绑整个仓库:git bundle create repo.bundle --all

捆绑分支:git bundle create repo.bundle branchname

捆绑一些提交:git bundle create commits.bundle branchname ^commit

对于将捆绑提交应用到本地仓库的人,他可以通过 git bundle verify /path/to/bundle/file 验证捆绑文件。

更多详情,可以参考Git's Little Bundle of Joy and git bundle

git daemon 在这种情况下效果很好。它的性能很好,但在 Windows 服务器上缺乏安全性。

在服务器端,运行以下命令:

cd ~/Documents/All-My-Git-Repos/
git daemon --verbose --reuseaddr --export-all --enable=receive-pack --base-path=.

在客户端,像这样克隆任何 repo:

git clone git://my-git-server-address/repo-folder-name repo-clone-name

在 Windows 服务器上使用它时,防火墙将提示对端口 9418 的权限,应该授予该权限。