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
This kind of push overwrites the contents of the Bitbucket repository. You should use it with great caution.
Navigate to the root directory of the repository you want to push.
$ cd ~/<repo_directory/repo_name>
Change the remote URL on your local repository to the Bitbucket repository to connect the two.
$ git remote set-url origin <bitbucket_URL>
You can find the URL next to the
git clone
command for the repository:Push the contents of your local repository to Bitbucket:
$ git push -u origin --all
You may need to authenticate your account by entering a password, unless you've set up an SSH key.
Pushing a Mercurial project
This kind of push overwrites the contents of the Bitbucket repository. You should use it with great caution.
- Add or update the remote URL on the repository's config file. If you already have a config file, skip c.
(macOS) Make sure you can see hidden files. Files that start with a . (period) are hidden by default in macOS.
Navigate to the repository locally. You should see a
.hg
directory in the repository directory.Download this
hgrc
file and add it to the .hg
directory: hgrcOpen the
hgrc
file and replace---Bitbucket URL---
or the existing URL with the remote URL.
You can find the URL next to thehg clone
command for the repository:- Save and close the
hgrc
file.
From the command line, navigate to the root directory of the local repository:
$ cd ~/<repo_directory/repo_name>
Push the repository:
$ hg push
You may need to authenticate your account by entering a password, unless you've set up an SSH key.