Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Sharing a same Git repository on 2 computers


first thanks for the great service you are providing.

i'm using webstorm on ComputerA and B.

On computerA, I correctly set webstorm to use GIT repository on Bitbucket, and i'm able to push my commits there.

Now, on computerB, where I also have webstorm installed, I would like to retrieve the same repository from Bitbucket -> ComputerB. Also I would like to be able to make change from computer A or B, and have it synch on both computers, from Bitbucket repository.

How should I do to get files copied from the repository into computerB? Should I create several users on Bitbucket ? Because I try to access bitbucket on computerB with same user.

So I tried to setup access to same repository on computerB, then "fetched" project: that was successfull but no file were downloaded. So what should I do ?

5 answers

1 accepted

1 vote
Answer accepted

It's not a problem to use the same Bitbucket account to clone a repository to a multiple computers and work independently on the computers and sync the changes via Bitbucket repository. I have several cases where I do exactly that - it's just a normal git workflow.

Think it this way: from git point of view the following cases are equal:

  • user A has three clones of a repository in three different computers
  • users A B and C each have a single clone of a repository in their own computers

In both cases commits can be made to all the local repositories and pushed to and pulled from Bitbucket.

I agree that this is the best way. But the OP's own answer says (paraphrased): I cloned to both machines and tried pulling to each. It works, but I don't know if it is a viable solution.

I'm not sure why he says that it might not be viable, but if he doesn't want to have to pull, things are going to get complicated.

I am implementing a similar workflow. Did it work in the long run as expected?

I found this link here which suggests that having different SSH keys for both the machines is best practice. 

Hi thanks for your answers, I confirm I got that working.
From computerA I initally pushed my app code into bitbucket.
Then on computerB, from webstorm I chose to clone from VCS first thing, then choose, Git, then specified my bitbucket URL. This cloned the content online into computerB.

Now, whenever I make a change on one computer, I comit and push, and on the other computer I go into the concerned branch and update project. And I got all the changes, so it works as intended.

It's not a problem that I have to comit / push / update, sorry if I was not clear Seth.

No problem. You are doing it the right way.

I tried to clone git directory on both machines, then pull the changes to update code on both... seems to work, but not sure if its a viable way

What you're asking is not possible using Git. What you should do if you want to work like that is to put the code in a shared folder that both PC's will use.

If the project is small enough, use a tool like DropBox that keeps files in sync AND local (Git sometimes has odd problems operating on network shares). As long as the entire repository is in DropBox (including .git/) you should get the result you're looking for.

Note: Do NOT attempt to modify the repository on both computers at the same time using this method.

Err ... I fail to see why this can't be accomplished. Every git repository clone is a first-class citizen and can work with numerous remote repositories. I have several cases where I have cloned a repository from Bitbucket to multiple computers using the same account and I keep them sync via Bitbucket - that's just a normal git workflow.

I interpret Benjamin's question (especially after reading his second answer) as wanting his repositories to stay in sync without the extra step of pulling.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Bitbucket

New improvements to user management in Bitbucket Cloud 👥

Hey Community! We’re willing to wager that quite a few of you not only use Bitbucket, but administer it too. Our team is excited to share that we’ll be releasing improvements throughout this month of...

3,795 views 10 16
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you