Abhishek
Abhishek

Reputation: 2945

Multiple users for single repository

This is my problem:

I have a single server used by multiple users though different logins. The limitation is disk size. Currently, separate directories are created and users have checked out the repo into their respective directories. But this is taking up most of the disk space.

I want to reduce the disk usage. If I use a single account then the commits will become messy. What is the best solution for multiple users to use git on the server?

How can I configure multiple users for a single repo? I can configure .gitconfigure for multiple users, but the .git/config contains a URL which contains the username.

Upvotes: 1

Views: 2901

Answers (2)

Yue Lin Ho
Yue Lin Ho

Reputation: 3111

Do you? 1. have a bare repo on server? 2. each user has a cloned repo(not bare, has working tree) on server too?

If all yes(everything on server), perhaps try "shallow" clone to save disk space:

enter image description here


Then, use patches work flow to manage your main repo:

You create one bare repo for shallow cloning, and one repo(not bare) for applying patches.

Others clone that bare repo with shallow, then coding, commit, create patches, send patches to you.

You apply those patches on feature branch, review the code, merge the branch into master branch, push master to bare repo.


push/fetch/pull can be used normally, please refer to Is it safe to shallow clone with --depth 1, create commits, and pull updates again?.

Upvotes: 0

dan
dan

Reputation: 13262

You should use a centralized repository approach, check here for more details.

This way you will create a single bare repository that each developer will be able to access. And each of them will be able to clone and create their own private working copy on their local environment.

Upvotes: 1

Related Questions