Push versioned code to an empty repository
You can upload an existing repository to a empty project in Bitbucket. When you do this, Bitbucket maintains your commit history.
If you don't yet have a Bitbucket repository, create a repository there first.
Pushing a Git project
From the command line, verify your SSH key is working.
$ ssh -T email@example.com
conq: logged in as tutorials.
You can use git or hg to connect to Bitbucket. Shell access is disabled.
The message should report you are logged in as your Bitbucket account. In this example, the ssh key was on the
tutorialsaccount. If you don't get this message, stop and troubleshoot your SSH connection to Bitbucket. (See Use the SSH protocol with Bitbucket Cloud for information about doing this.)
Navigate to the root directory of the repository you want to push.
$ cd ~/repos/<repo_name>
Push the local repository up to Bitbucket.
$ git push --mirror firstname.lastname@example.org:<account_name>/<repo_name>
If you want, you can push several branches at once to your Bitbucket repository. To do this, do the following:
- Checkout each branch to your local repository from your existing Git host.
List all the branches to make sure you have what you want:
$ git branch -a
Make sure the remote origin in your local repository points to Bitbucket.
For example, if you are using ssh with Bitbucket, you would use the following:
$ git remote set-url origin ssh://email@example.com/<account_name>/<repo_name>.git
Then push all the branches to Bitbucket:
$ git push -u origin --all
Pushing a Mercurial project
From your Mercurial repository on your local system, open the
- Open the
defaultvalue by changing it to the address of the empty repository you created in Bitbucket. The top of your file will look similar to the following:
- Save and close the file.
Push the repository:
$ hg push
Was this helpful?
Thanks for your feedback!