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.

  1. Navigate to the root directory of the repository you want to push.

    $ cd ~/<repo_directory/repo_name>
  2. 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:

  3. 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.

Last modified on Apr 7, 2022

Was this helpful?

Provide feedback about this article
Powered by Confluence and Scroll Viewport.