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

Pointing Bitbucket at an existing repository

Bill Wohler February 10, 2021

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 M
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 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

Bill Wohler February 10, 2021

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 M
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 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

Bill Wohler February 10, 2021

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 M
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 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.

Bill Wohler February 10, 2021

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 M
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 10, 2021

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

But it can be achieved via Mirroring.

Christian Glockner
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
February 11, 2021

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 M likes this
Pramodh M
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 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

Bill Wohler February 11, 2021

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
AUG Leaders

Atlassian Community Events