Multiple users for single git repository

725 views Asked by At

We have a single server which is being used by multiple users. Disk space is quite the limitation as our git repo is quite huge and every time someone clones it, it consumes 130G of space.

I understand that git is not designed to be centralised workflow but this is a very peculiar situation. We thought about upgrading the hardware but that's quite a long path as it's not a cloud instance.

I tried fiddling with git worktree but I soon ran into permission issues. My Ideal setup would be a single repo and multiple users can push and pull via through this.

I looked into the previous threads on this but unfortunately nothing solid advice over there and they are quite old threads. So, any new advice would be highly appreciated.

3

There are 3 answers

0
Shell Code On

Perhaps look into git subtree or git submodule to divide your big git repo into several smaller ones. It still stays the same big repo, but can be more manageable.

Notice for submodules:

When you clone such a project, by default you get the directories that contain submodules, but none of the files within them yet

So when you say

$ git clone https://github.com/myco/MainProject

it only downloads the main repo and the folders of the sub modules. You can then specify which submodule files you want to download with.

$ cd subModuleDir
$ git submodule init
$ git submodule update

Thus, it only clones the files for the submodule and not all the files.

0
VonC On

Another approach is to use git worktree, in order to checkout multiple branches in multiple different path, while keeping only one cloned repository.

Combine that with some partial clone with filter and sparse cone and:

  • your main repository can be smaller than it is today (because some files not needed for your collective work are filtered, and because not the full history is fetched)
  • your different branches are checked out without having to clone again the repository.
0
Daemon Painter On

I'm not sure about what you are asking here: you have a single machine being used by multiple users, and each clone is destroying the available space.

Then, just have a single copy, in a folder accessible to all windows users, and have each person work on a separate branch there.

Appoint someone as "manager" to manage merge on master and curation of the "blessed" information.