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

Migrating GitHub to Bitbucket Server, forked repos

Edward Basiliere May 5, 2017

Hello,

I am working on moving many repositories from our GitHub instances to Bitbucket Server.

We have a main organization that our other orgs fork from in GitHub. I am moving all of these repositories over, but need to keep this forked relationship between the repos. Is this a possibility?

Bitucket Server: v4.13.0

Thanks!

1 answer

1 accepted

1 vote
Answer accepted
Edward Basiliere May 10, 2017

Found a manual solution. Adding it here in case anyone ever runs into this. This method can work from any Git source, not just GitHub to Bitbucket.

  1. Clone the main repo from GitHub using --bare. (git clone --bare [repoURL])
  2. Clone the forked repo from GitHub using --bare. (git clone --bare [repoforkURL])
  3. Create a new repo in Bitbucket for the main repo.
  4. Clone the new repo from Bitbucket.
  5. Commit and Push a dummy file to the main repo in Bitbucket (I chose to use do a readme file)
  6. In Bitbucket, fork the main repo to whichever project you want the fork to exist.
  7. Add a remote for the Bitbucket main repo to the bare repo from Step 1. (git remote add [repoURL])
  8. Push all the repo data to the Bitbucket main repo. (git push --all bitbucket) (git push --tags bitbucket)
  9. Add a remote for the Bitbucket forked repo to the bare repo from Step 2. (git remote add [repoURL])
  10. Push all the repo data to the Bitbucket forked repo. (git push --all bitbucket) (git push --tags bitbucket)

Note: You may see some conflicts when pushing to the repos. Use --force to overwrite the dummy file added in Step 5.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events