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 ~/repos/<repo_name>
  2. Push the local repository up to Bitbucket.

    $ git push --mirror git@bitbucket.org:<account_name>/<repo_name>

Push Several Branches at Once

If you want, you can push several branches at once to your Bitbucket repository. To do this, do the following:

  1. Checkout each branch to your local repository from your existing Git host.
  2. List all the branches to make sure you have what you want:

    $ git branch -a
  3. 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:

  4. Then push all the branches 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. From your Mercurial repository on your local system, open the .hg subdirectory.

    Files that start with a . (period) are hidden files in Mac OSX. By default, the Finder does not show these files. To reveal hidden files, enter the following command into the terminal:

    $ defaults write com.apple.finder AppleShowAllFiles YES

    To hide them files once again, enter the following command:

    $ defaults write com.apple.finder AppleShowAllFiles NO
  2. Open the hgrc file.
  3. Edit the default value 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:

    [paths]
    default = ssh://hg@bitbucket.org/<account_name>/<repo_name>
  4. Save and close the file.
  5. Push the repository:

    $ hg push
最終更新日 2017 年 8 月 30 日

この翻訳に満足しましたか?

はい
いいえ
この記事についてのフィードバックを送信する

お探しの情報が見つかりませんか?

コミュニティへの質問

Powered by Confluence and Scroll Viewport.