Create
cancel
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

Pointing Bitbucket at an existing repository

We don't need a Git repository as we already have one. We just purchased Bitbucket (server) for its code review features. I was a little surprised to find that it doesn't appear to be possible to point it at an existing repository. It seems that we'd have to clone our existing repositories into Bitbucket and then abandon those repositories.

Is it true that Bitbucket only works with internal repositories? If so, why is that?

1 answer

1 accepted

0 votes
Answer accepted
Pramodh Community Leader Feb 10, 2021

Hi @Bill Wohler 

You have to understand how Git works here.

For any changes to be appeared in the Bitbucket server first create a repository, and wherever your repository is you can push the changes to your server by adding the remote link to your server.

I'm not sure what you mean by internal repositories, please let me know more on that.

Thanks,
Pramodh

Thanks, Pramodh. Let's see if an example will help. Our external Git repository is at, say, git.domain.com and our Bitbucket server is at bitbucket.domain.com. I was referring to any repositories at bitbucket.domain.com as internal. I want the Bitbucket server to use the Git repository at git.domain.com. In other words, our developers want to keep developing on git.domain.com and view their code reviews on bitbucket.domain.com.

Pramodh Community Leader Feb 10, 2021

Say what is this git.domain.com is? which is this external Git repository?

Could you please help me understand here?

And is bitbucket.domain.com Bitbucket Server

We've cloned from git.domain.com:

[wohler@host project (master=)]$ git remote -v
origin ssh://git.domain.com/GIT/project.git (fetch)
origin ssh://git.domain.com/GIT/project.git (push)

It would be preferable if this doesn't change for our developers.

Yes, bitbucket.domain.com is the Bitbucket server.

Pramodh Community Leader Feb 10, 2021

The requirement is very strange, I guess what you are trying to say is mirroring.

Here's an idea you can try.

Let Bitbucket handle all the git operations (fetch and push) and pull requests.

What you can do is, write a custom script to push the code from the Bitbucket server to External Git Server, or the other way around works too.

I think what you are saying is that you can't point Bitbucket to an external repository.

Our team would also like to know why that is so.

Pramodh Community Leader Feb 10, 2021

Yes, that is correct. Because such feature is not available yet!

But it can be achieved via Mirroring.

Hi Bill,

Bitbucket Server is not just a code review tool but rather a tool that allows you manage git repositories hosted on it, including code reviews as part of pull requests.

Bitbucket's model is built around the repositories being hosted locally, and that's the way it's always been.

You're probably aware, but you can import your existing repo into Bitbucket Server and then work with that repo instead. We've got details on how to do that at https://confluence.atlassian.com/bitbucketserver/importing-code-from-an-existing-project-776640909.html

Cheers,

Christian

Premier Support Engineer

Atlassian

Like Pramodh likes this
Pramodh Community Leader Feb 11, 2021

I have seen some customers who already have some external git server but they want the code in these famous Git hosting tools like Bitbucket, and you know what I'm going to say next 😆 Just making a joke there, please don't send this to spam 😉

In this case, if they are strict about what they are following we have the option of mirroring.

If they are willing to change the entire system to Bitbucket, that's good too!!

Thanks,
Pramodh

Christian, thanks for sharing the design model. That certainly makes sense.

To help you understand why I'm asking, our need to switch our Git repository to Bitbucket is causing a bit of a kerfuffle in our NASA group with its rigid security plans.

Pointing Bitbucket to an external repository in order to get all of the benefits of Bitbucket aside from hosting might not be a frequent requirement, but it is important in our case.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
TAGS
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,708 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