Push versioned code to an empty repository

Still need help?

The Atlassian Community is here for you.

Ask the community

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

Pushing a Mercurial project

This kind of push overwrites the contents of the Bitbucket repository. You should use it with great caution.

  1. Add or update the remote URL on the repository's config file. If you already have a config file, skip c.
    1. (macOS) Make sure you can see hidden files. Files that start with a . (period) are hidden by default in macOS.

      To reveal hidden files

      Enter the command for revealing hidden files followed by a command to close and reopen your Finder windows:

      $ defaults write com.apple.finder AppleShowAllFiles -boolean true
      $ killall Finder
    2. Navigate to the repository locally. You should see a .hg directory in the repository directory.

    3. Download this hgrc file and add it to the .hg directory: hgrc

    4. Open the hgrc file and replace ---Bitbucket URL--- or the existing URL with the remote URL.
      You can find the URL next to the hg clone command for the repository:

    5. Save and close the hgrc file.
  2. From the command line, navigate to the root directory of the local repository:

    $ cd ~/<repo_directory/repo_name>
  3. Push the repository:

    $ hg push
Last modified on Jun 5, 2018

Was this helpful?

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