How many clones of repository are required?

Sneha Bhasin February 12, 2018

We are using sourctree on RDS to connect to bitbucket.

Is it necessary to clone repository for each user or a single clone can be shared by all users?

Cloning repository/user will occupy lot of space. Can someone suggest any alternative wherein all users can access a single clone from the bitbucket?

 

1 answer

0 votes
Ben Stuart
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
February 13, 2018

Hey Sneha, I'm not sure I understand you question. Usually each user will have a  local clone of the central repository. Each user will push their changes/ branches to the central repository. Or are you talking about personal forked repositories

I would suggest you read Comparing Workflows for a detailed explanation and examples. 

Sneha Bhasin February 13, 2018

 

@Ben Stuart

Hi Ben. My question is that is it possible that we maintain one common clone which is accessed by each user and each user pushes his/her change to this clone which inturn pushes to the target location.?

We are using Tortoise Git as a client for Bitbucket and once we commit changes,  Jenkins will trigger build. Our Tortoise GIT is on RDS.

Do you think with these tools , such a setup is possible?

Ben Stuart
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
February 14, 2018

Hey Sneha, 

I don't think this setup would be feasible or efficient for how Git was designed to be used. This sounds pretty similar to a forking model though. Check out forked repositories. You can have all your developers working on the fork and then create pull requests to the primary repository once you finish with your changes. I could be misunderstanding your use case though. Maybe you can explain more why you would like this workflow and what you're trying achieve by setting it up in this way. 

Sneha Bhasin February 14, 2018

 

@Ben Stuart: Could you suggest any git clents for bitbucket that could help me achieve this(single clone for all users)?

The issue is that if each user maintains a clone of repository, that is occupying a lot of space and that is what we are trying to overcome

Ben Stuart
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
February 14, 2018

I'm not sure of any Git clients that could do this as it goes against the nature of Distributed Version Control Systems. If you're mostly concerned with disk space on your developer's local machines, I have a few suggestions that may help. 

If your repository is very large due to file sizes or number of branches, your developers can use the following command to clone a branch or subsection of the repository.

git clone <url> --branch <branch> --single-branch [<folder>]

If your repository is large due to a long commit history, your developers may just want to clone one or two commits with a "Shallow Clone" command like this:  

git clone --depth [depth] [remote-url]

I would recommend you read How to Handle Big Repositories with Git for more information. 

There are also ways you can reduce the size of your repository which might be helpful. You can ignore the Bitbucket Cloud related restrictions described there and focus on these sections: 

I hope that helps!

Sneha Bhasin February 15, 2018

 

@Ben StuartThanks a lot Ben

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events