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

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

chandreddy August 18, 2021

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
Atlassian Team members are employees working across the company in a wide variety of roles.
August 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

chandreddy August 19, 2021

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

Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 23, 2021

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

chandreddy August 23, 2021

@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?

Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 23, 2021

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
chandreddy August 23, 2021

@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?

chandreddy August 23, 2021

@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
Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 24, 2021

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

chandreddy December 13, 2021

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.

chandreddy December 14, 2021

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

Atlassian Community Events