Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,294,708
Community Members
 
Community Events
165
Community Groups

I have the requirement of copying the bitbucket project from location X to another location Y

Edited

I have the requirement of copying the bitbucket project from location X to another location Y by retaining all the commit history from source location X. Please advise.

1 answer

1 accepted

0 votes
Answer accepted
Caroline R Atlassian Team Aug 19, 2021

Hi, @chandreddy! Welcome to the community! 

If you have administrative rights to this repository, you can change or transfer the ownership of the repository to another workspace. The transferred repository comes with its commit history and wiki, but it will lose the access groups and won’t inherit the destination account's default access groups. You'll have to set those on the repository after the transfer.

In order to transfer the repository ownership, you can follow the next steps:

  • Access the repository you want to transfer > click Repository settings in the left menu.

  • Select the option Manage repository > click Transfer repository.

  • Enter the Workspace ID of the workspace in which you want to transfer the repository.

  • Click Transfer. 

  • Then, Bitbucket will send an email to the new owner or workspace administrators containing the transfer request with a link to the page that allows the user to accept or reject the transfer. 

Please let us know if you have any questions about this process.

Kind regards,
Caroline

Thanks @Caroline R . Do old repository remains or does it gets deleted? I want to keep old one without deleting.

Hi @chandreddy,

Please allow me to step in here as Caroline is out of office.

If you transfer a repository, it will not remain in the original workspace.

Just to make sure I understand your requirements, when you say "copying the bitbucket project from location X to another location Y", by "location" you mean another Bitbucket workspace?

If so, then I can suggest two different options:

1. You can fork the repository to the same or different workspace

While viewing the repository on Bitbucket website, select the Source page, then select the 3 dots near the top right corner (next to the option Clone) > Fork this repository.

This option will be visible if forking is allowed for this specific repo.

The fork is linked to the original repo, so you have the option to sync it with the original one when more commits are made to it, and you can also create PRs from the fork to the original repo.

2. If syncing the two repos or creating PRs is not a requirement, you can also do the following:

  • Take a mirror clone of the repo with the command
git clone --mirror <repo-url>
  • Then, create an empty repository in Bitbucket Cloud
  • Push from that mirror clone to the newly created empty Bitbucket repo:
git push --mirror <url-of-the-new-empty-repo>

Please feel free to let us know if you have any questions.

Kind regards,
Theodora

@Theodora Boudale  Thank you very much for your reply. Just to clarify for both the options will have commit history from the original repo right?

Hi @chandreddy, you are very welcome, and to answer your question, yes, indeed.

With both options, all the commit history of the original repo will be copied to the new repo.

Please feel free to let us know if you have any questions when you try this.

Like chandreddy likes this

@Theodora Boudale Thanks. Can I also assume that mirror would also copy all branches feature, master etc would also be copied from the original repo?

@Theodora Boudale  never mind, I tried mirror and all branches got copied along with history. Thanks heaps both @Theodora Boudale  and @Caroline R  for your help on time.

Like Theodora Boudale likes this

Hi @chandreddy,

You are very welcome, we're glad to have helped.

The purpose of the --mirror flag in the clone command is to get all branches, if you do a 'git clone' without --mirror then you get locally only the main branch of the repo.

It's good to hear that you figured this out, if you ever need anything else, please feel free to reach out!

Kind regards,
Theodora

Hi @Theodora Boudale and @Caroline R 

After copying the old repo to new repo using Mirror option, some how both old and new repo are in Sync. That means all the commits that are done in new repo can also be seen and accessed in old repo. Having said this, we are not sure what is the impact if we try to delete the old repo that might cause everything gets deleted in new repo as well. Looks like they are in sync both ways?

I thought Mirror option does not do the sync of the both repos. I don't want to keep both in sync. Please advise.

Hi @Theodora Boudale and @Caroline R ,

I was able to fix the issue by updating the SCM properties in pom.xml to point to new repo and now problem is solved. On another note, I need to copy some of the tags from old repo to new repo is that possible and how?

Suggest an answer

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

Git push size limits are coming to Bitbucket Cloud starting April 4th, 2022

Beginning on April 4th, we will be implementing push limits. This means that your push cannot be completed if it is over 3.5 GB. If you do attempt to complete a push that is over 3.5 GB, it will fail...

2,159 views 2 9
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