動作環境/前提条件 †
- Windows 7 (32bit)
- Eclipse Luna SR2 4.4.2
- GitHubアカウント作成済み
EGitインストール †
SSH認証鍵生成 †
$ ssh-keygen -t rsa -C yjshimojo@gmail.com
Generating public/private rsa key pair.
Enter file in which to save the key (/home/y.shimojo/.ssh/id_rsa): [dir]/id_rsa // 鍵を保存するディレクトリを指定
Enter passphrase (empty for no passphrase): // パスワード入力
Enter same passphrase again: // パスワード再入力
$ cat id_rsa.pub
- GitHubログイン >> Personal settings >> SSH keys >> Add SSH key >> id_rsa.pubを追加
- Title: ローカルマシン名など
- Key: クリップボードの中身(SSH公開鍵情報)をペースト
Eclipseの公開鍵認証設定 †
- ウィンドウ >> 設定 >> 一般 >> ネットワーク接続 >> SSH2
- SSH2ホーム: SSH公開鍵の保管先を指定
- 秘密鍵: id_rsa
- 認証方法の「password」チェックを除外
EGitの初期設定 †
- ウィンドウ >> 設定 >> チーム >> Git >> 構成 >> エントリーの追加
- key: user.name / value: Yuji Shimojo
- key: user.email / value: yjshimojo@gmail.com
- 適用を選択
既存ワークスペースのプロジェクトからローカルリポジトリを作成 †
- パッケージ・エクスプローラー >> プロジェクト選択
- 右クリック >> チーム >> プロジェクトの共用 >> Git >> 作成
ローカルリポジトリへコミット †
- 任意のGitリポジトリーを選択
- 右クリック >> コミット >> src配下のみ選択
- 右クリック >> Init Git Flow
- developブランチ⇒masterブランチへ切り替え
リモートリポジトリへプッシュ †
- GitHubリポジトリー作成 ※「Initialize this repository with a README」にはチェックしない
- リモート >> プッシュ >> GitHubの認証情報を入力
GitHub + Cygwin 接続設定(参考) †
- GitHub用に秘密鍵名を変更する(id_rsa => id_rsa.github)
$ vi ~/.ssh/config
Host github.com
HostName github.com
User git
IdentityFile ~/.ssh/id_rsa.github
Port 22
$ ssh-add ~/.ssh/id_rsa.github
$ ssh-add ~/.ssh/id_rsa.github
Could not open a connection to your authentication agent.
$ eval `ssh-agent -s`
$ ssh-add ~/.ssh/id_rsa.github
Enter passphrase for /home/y.shimojo/.ssh/id_rsa.github:
Identity added: /home/y.shimojo/.ssh/id_rsa.github (/home/y.shimojo/.ssh/id_rsa.github)
$ ssh git@github.com
The authenticity of host 'github.com (192.30.252.129)' can't be established.
RSA key fingerprint is 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'github.com,192.30.252.129' (RSA) to the list of known hosts.
PTY allocation request failed on channel 0
Hi yujishimojo! You've successfully authenticated, but GitHub does not provide shell access.
Connection to github.com closed.
$ git init
$ git add .
$ git commit -m "initial commit"
$ git remote add origin git@github.com:yujishimojo/[repo].git
$ git push -u origin master