Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multiple users for single git repository

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.

like image 995
Rohith Uppala Avatar asked Nov 22 '20 11:11

Rohith Uppala


People also ask

Can 2 people own a GitHub repository?

The free/Individual version allows for up to three "collaborators". That should be exactly what you're looking for. The team versions, on the other hand, allow for multiple collaborators AND "user management". If you wanted finer control over what collaborators can and cannot do, you'd need a team version.

Can a repository have multiple owners?

You can only add collaborators to your repository. It cannot be "co-owned". The only way for doing what you want is to fork the repo and collaborate through pull requests. Note that you can create an organization ( https://github.com/account/organizations/new ) and achieve a bit of what you want.


Video Answer


3 Answers

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.
like image 156
VonC Avatar answered Oct 18 '22 20:10

VonC


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.

like image 40
Shell Code Avatar answered Oct 18 '22 21:10

Shell Code


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.

like image 28
Daemon Painter Avatar answered Oct 18 '22 19:10

Daemon Painter