I have a git repository, a "local" one on my PC and a remote one hosted locally on my private network.
I would like to replace this locally-hosted remote repository by a bitbucket one. And I don't find the steps to do this.
All the instructions I see relies on the repository to clone be available by a public url. Which is not my case.
How should I do ?
Hi @LV and welcome to the community!
Assuming that your PC can access the server where this repository is hosted, you can do the following:
1. Create a new empty Bitbucket Cloud repository from our website. Ensure that the options for README and .gitignore in the repository creation page are both set to No, so that the repository is empty.
2. On your PC, take a mirror clone of the repo
git clone --mirror repo_url_on_your_private_server
A mirror clone will get all branches, if the repo has more than one branch.
3. Switch to the directory of your mirror clone
4. Add a new remote URL to that mirror clone that points to the empty Bitbucket repo you created in Step 1.
git remote add bitbucket git@bitbucket.org:workspace-id/repo.git
where workspace-id and repo replace with the values for your Bitbucket repo. This is an SSH URL, but you can also use an HTTPS one instead, if you haven't set up SSH:
git remote add bitbucket https://username@bitbucket.org/workspace-id/repo.git
where username, workspace-id and repo replace with the values applicable to your user and repo.
5. Afterwards, push to the Bitbucket repo with the command
git push --all bitbucket
Please feel free to reach out if you have any questions.
Kind regards,
Theodora
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.