Add unversioned code to a repository

このページの内容

If you have code on your local machine that is not under source control, you can prepare it by putting your code into a Git or Mercurial repository locally. From there, you push it to Bitbucket.

If you don't yet have a Bitbucket repository, create a repository there first.

Add to a Git repository

  1. From your terminal, change to the root directory of your existing code.
  2. Initialize the directory under source control from the following command:

    $ git init
  3. Add the existing files to the repository you have initialized:

    $ git add .
  4. Commit the files:

    $ git commit -m 'initial commit of full repository'
  5. From the Overview page of the repository you created in Bitbucket, choose I have an existing project.
  6. Connect your new local repository to the remote repository on Bitbucket. To do that, copy the git remote path that you see under I have an existing project and enter it in the command line.
  7. Push all the code in your local repo to Bitbucket with the following command:

    $ git push -u origin --all

Add to a Mercurial repository

  1. From your terminal, change to the root directory of your existing code.
  2. Initialize the directory under source control from the following command:

    $ hg init
  3. Add the existing files to the repository you have initialized:

    $ hg add
  4. Commit the files:

    $ hg commit -m 'initial commit of full repository'
  5. From the Overview page of the repository you created in Bitbucket, choose I have an existing project.
  6. Connect your new local repository to the remote repository and push all your code to Bitbucket at the same time. To do that, copy the hg push path that you see under I have an existing project and enter it in the command line.
最終更新日 2017 年 3 月 9 日

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

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

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

コミュニティへの質問

Powered by Confluence and Scroll Viewport.