Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

After trying to FORK a GitHub repository inside Bitbucket, the Bitbucket repository is empty

john peter October 22, 2024

I want to FORK a GitHub repository inside BitBucket cloud and work on the code using Visual Studio Code. here are the steps i tried so far:-

1) Created a new repository inside BitBucket web

2) Install GIT CMD on my local machine

3) Run those commands: -

 

 

 

 

 

but when i checked the BitBucket repository, it is still empty:-

 

<screenshot_removed>

 

Unlike the GitGub repository:-

 

<screenshot_removed>

 

My plan was to Fork the GitHub repo inside BitBucket, and then work on the BitBucket locally using Visual Studio code.. any advice please?

 

 

 

1 answer

0 votes
Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 23, 2024

Hi John and welcome to the community!

I'm not sure what commands you ran, it looks like they weren't pasted in your message.

You can do one of the following two things:

1. Use the import option on our website:

  • Open the workspace where you want to create this repo on Bitbucket Cloud's website.
  • Select the Create option from the top menubar > select Repository.
  • Select the link Import repository (it is right next to the heading Create a new repository).
  • Enter the URL of the GitHub repo.
  • If the repo is private, select Requires authorization and provide the GitHub credentials. I believe that for GitHub you will need to use a personal access token in the field of password.
  • Select the project where you want this repo to be belong in the Bitbucket workspace, and provide a repository name.
  • Then, select Import repository.


2. Another option is to use the command line.

  • Create a new empty (no README or .gitignore) repository in Bitbucket Cloud from our website.
  • Clone the GitHub repository with the --mirror flag (so that you get all branches)
    git clone --mirror github_repo_url

    where github_repo_url replace with the URL of the GitHub repo.
  • Navigate to the directory of the mirror clone.
  • Add a new remote in that mirror clone that points to the Bitbucket repo
    git remote add bitbucket bitbucket_repo_url

    where bitbucket_repo_url replace with the URL of the empty Bitbucket Cloud repo you created earlier. This URL should have the following format if you use HTTPS:

    https://username@bitbucket.org/workspace-id/repo.git

    or the following format if you use SSH:

    git@bitbucket.org:workspace-id/repo.git
  • Then, push to the Bitbucket Cloud repo with
    git push --all bitbucket


Please feel free to let me know how it goes and if you have any questions!

Just a heads up, I removed the screenshots from your post for privacy reasons.

Kind regards,
Theodora

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events