LoginSignup
9
6

More than 5 years have passed since last update.

Cloud9からbitbucketへpushする方法

Last updated at Posted at 2017-09-22

 使う環境 

Bitbucket
https://bitbucket.org/
リポジトリが作成されている必要があります。

Cloud9
https://c9.io/xxxxxxxxx(個人による)

Cloud9側での作業

Cloud9でSSH Keyを入手する。
https://c9.io/account/ssh

ログインしているアカウントのSSH Keyが表示される。

Bitbucketでの作業

BitbucketでCloud9から入手したSSH KeyをAccess keysに追加する。
 追加するリポジトリを選択
  設定
   Access keys
    鍵を追加

コピーしてきた、Cloud9のSSH Keyを入力する。
できたら鍵を追加をする。
成功していると、鍵のところに情報が追加されている。
これで外部からのアクセスを許可してる。

リモートリポジトリと同期する方法

Cloud9からBitbucketにアクセスできるようにする。

最初にローカルリポジトリを作成する

適当に作業フォルダを作る

$ mkdir git

Gitを有効にするためにコマンド実行

$ git init

リモートリポジトリを追加する。

$ git remote add origin https://xxxxx.org/yyyyy/zzzzz.git

追加されたことを確認

$ git remote -v
origin https://aaaaa@bxxxxx.org/yyyyy/zzzzz.git (fetch)
origin https://aaaaa@bxxxxx.org/yyyyy/zzzzz.git (push)

リモートリポジトリと同じ内容にするために、マージする。

$ git merge --allow-unrelated-histories origin/master

マージが完了しているか、フォルダを確認する。

nkns:~/workspace/git (master) $ ls
README.md sample.txt ttt.txt

リモートリポジトリと同じ内容になっていれば、作業完了!

9
6
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
9
6