3

I need to share a large git repository (>3GB in total, .git folder is ~1.1GB) as Windows Shared Folder over LAN with my colleagues. But they found it is really slow to clone and push/pull -- i.e. waits ~30min before the clone starts, and suspended ~5min before any push/pull starts.

Does everyone know any methods to reduce the latency or better way to share the repo?

P.S. I don't want to setup a Gitlab because it's too complicated.

Vej
  • 390
  • 1
  • 7
  • 28
  • How long does it take to copy the equivalent amount of data across your network, just using normal windows explorer? – Lasse V. Karlsen May 11 '17 at 12:14
  • The thing is that every pull/push takes too much time to wait before the pull/push really starts. – Vej May 11 '17 at 12:18
  • The LAN is very stable. Copying large file is up to 30MB/s. The repo contains too many small files, so it takes long to copy as file. – Vej May 11 '17 at 12:24

2 Answers2

4

Since your git repo is very big, you can bundle the whole git repo or part of commits among your colleagues sharing.

Bundle the whole repo: git bundle create repo.bundle --all

Bundle a branch: git bundle create repo.bundle branchname

Bundle some commits: git bundle create commits.bundle branchname ^commit

For the one who apply the bundled commits to his local repo, he can verify the bundle file by git bundle verify /path/to/bundle/file.

More details, you can refer Git's Little Bundle of Joy and git bundle.

Marina Liu
  • 36,876
  • 5
  • 61
  • 74
  • Thanks! `git bundle` is something like packing the commits for sharing, but it needs extra commands to pack/unpack, and kinda hard to maintain while the repo itself is getter bigger. I'd like to use the method like `git daemon`, which improves the perf and remains simple. – Vej May 11 '17 at 17:38
  • For `git bundle`, you need to unpack the whole repo for the first time, after that you only need to bundle/unbundle for the new commits. And yeah, `git daemon` is also a good choice, if you don't want to bundle/unbundle each time, you can follow the way `git daemon`. – Marina Liu May 12 '17 at 00:13
  • Okay. Thanks! Just found `receive-pack` option in `git daemon`, which allows my peers to write this repo. Cool! – Vej May 12 '17 at 07:32
  • Since you solved the problem, you can add/mark the answer. And it will help others who have similar questions. – Marina Liu May 12 '17 at 07:39
  • Okay. Let me test both solutions and write down more details here. – Vej May 12 '17 at 14:06
2

git daemon works really well in this situation. Its performance is good, but lacks of security on Windows Server.

On server side, run the following command:

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

On client side, clone any repo like this:

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

While using this on Windows server, the firewall will prompt for permissions on Port 9418, which should be granted.

Vej
  • 390
  • 1
  • 7
  • 28