#9 Bitbucketでプロジェクト管理

第9回では、ソースコードをGitで管理します。三日坊主で終わるかもしれないと思っていたこの開発も地道に継続できているので、Bitbucketにリポジトリを作成して管理していきます。

  1. Bitbucketで新規リポジトリの作成
  2. 「ローカルディレクトリを設定する」のガイドに沿って作業
$ cd /path/to/your/project
$ git init
$ git remote add origin git@bitbucket.org:foo/bar.git
$ git add ./
$ git commit -m 'Initial commit'
$ git push -u origin master

下記のエラーが表示されたので、~/.ssh/configに設定を追加します。

Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

~/.ssh/config

Host bitbucket.org
  HostName bitbucket.org
  IdentityFile ~/.ssh/id_rsa
  User git
$ pbcopy < ~/.ssh/id_rsa.pub

Bitbucketに公開鍵を登録

$ git push -u origin master

無事に作成できました。

参考