Repository commingling with two remote repos on different hosts

I recently created a new repository on bitbucket with conventional naming scheme of 'origin' and added it to Sourcetree in the Bookmarks window. Now an existing repository (also named origin) that I have been editing with sourcetree (hosted on github) appears to think it is pointing to this new repo. If I view the Hosted Repositories window, these two repositories show the correct hosts. I can't figure out how to view the remote url setting (which I suspect may be the issue) within Sourcetree. I believe I have mixed hosts (beanstalk) in the past without issue.

5 answers

1 accepted

.git/config file from existing repository was somehow modified during setup of 2nd repository on different host. See above steps to repair.

Ok, a few questions and clarifications:

1) Git or Hg (Mercurial)? Windows or Mac?

2) Please remember that SourceTree is working with local repositories, and each repository should have an independent set of remotes. You say "an existing repository (also named origin) that I have been editing with sourcetree (hosted on github) appears to think it is pointing to this new repo". That makes it sound like Github has your new Bitbucket repo as a remote. I think you mean to say that your local clone of your GitHub repository now has the Bitbucket repo as its origin remote. Is this correct?

3) Please verify that the two local repositories are completely separate - they should be different SourceTree bookmarks AND reside in different locations on your hard drive.

1) Git & OSX 10.8.5 & Sourcetree 1.9.4

2) Yes, that's correct - I can verify that the .git/config file in my older GitHub local repo was modified to point to the new Bitbucket repo. Only thing I remember doing on the commandline was 'git init' inside the new repo when I created it. I have edited the older repo's config file to restore the correct remote url, but git status still reflects the other remote (tells me I have lots of pushes) - which is purely my issue in not fully understanding git, and I'll try to hunt down the cause before being tempted to give up and just re-clone.

3) Yes, they have distinct bookmarks & hard drive locations (Hosted Repositories view even shows the distinct hosts).

Now that you've fixed the old repo's config file, run a "fetch" command to fix your issue with git status.

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published May 30, 2018 in Sourcetree

Tip from the team: configuring Git or Mercurial in Sourcetree

Supported Platforms macOS Windows To make using Sourcetree as simple yet powerful as possible we embed (bundle) dependencies such as Git, Git LFS, and Mercurial. We strive to keep these...

432 views 0 1
Read article

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