Sharing a same Git repository on 2 computers

Hi,

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 ?

4 answers

1 accepted

This widget could not be displayed.

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.

This widget could not be displayed.
Timothy Chin Community Champion May 04, 2014

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.

This widget could not be displayed.

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

This widget could not be displayed.

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.

Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted Friday in Bitbucket

What is your #1 piece of advice to new users getting started using Bitbucket?

Hello Community! My name is Claire Maynard, and I’m a Product Marketing Manager on the Bitbucket team. I’m interested in hearing what advice or tips you have for new users getting started on ...

169 views 9 2
Join discussion

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you