Help us understand the problem. What is going on with this article?

Bitbucketに新規リポジトリを作成後、既存の作業ディレクトリと紐付ける

More than 3 years have passed since last update.

既存の作業ディレクトリと新規作成したBitbucketのリポジトリを紐つけたいことがあったので、その時の対応メモです。

環境:
- macOS Sierra
- git 2.8.2

Bitbucketで新規にリポジトリを作成すると、下記のようが画面がでてきます。
outerbridge   myrepo — Bitbucket.png

で、これを鵜呑みにすると以下のようなエラーが、、

$ cd /path/to/my/repo
$ git remote add origin https://outerbridge@bitbucket.org/outerbridge/myrepo.git
fatal: Not a git repository (or any of the parent directories): .git

そもそも、リポジトリがないからエラーになってるようです。
ということで、"git init"してから再度トライ。

$ cd /path/to/my/repo
$ git init // これ大事
$ git remote add origin https://outerbridge@bitbucket.org/outerbridge/myrepo.git
$ git add .
$ git commit -m "initial commit"
$ git branch // push前に、念のため masterブランチができてるか確認
* master
$ git push origin master

これで、紐付けが完了。

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした