#contents ** 動作環境/前提条件 [#afcc7ed6] - Windows 7 (32bit) - Eclipse Luna SR2 4.4.2 - GitHubアカウント作成済み ** EGitインストール [#ubd69fe7] // - Eclipseヘルプ >> Eclipseマーケットプレイス >> EGitを検索しインストール - Eclipseヘルプ >> 新規ソフトウェアのインストール - 作業対象: http://download.eclipse.org/egit/updates ** SSH認証鍵生成 [#ga045bdc] - Cygwinで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: // パスワード再入力 - SSH公開鍵の標準出力をコピー $ cat id_rsa.pub + GitHubログイン >> Personal settings >> SSH keys >> Add SSH key >> id_rsa.pubを追加 + Title: ローカルマシン名など + Key: クリップボードの中身(SSH公開鍵情報)をペースト ** Eclipseの公開鍵認証設定 [#e33547bf] + ウィンドウ >> 設定 >> 一般 >> ネットワーク接続 >> SSH2 + SSH2ホーム: SSH公開鍵の保管先を指定 + 秘密鍵: id_rsa + 認証方法の「password」チェックを除外 ** EGitの初期設定 [#h7ecddf1] + ウィンドウ >> 設定 >> チーム >> Git >> 構成 >> エントリーの追加 + key: user.name / value: Yuji Shimojo + key: user.email / value: yjshimojo@gmail.com + 適用を選択 ** 既存ワークスペースのプロジェクトからローカルリポジトリを作成 [#n4bbcdf7] + パッケージ・エクスプローラー >> プロジェクト選択 + 右クリック >> チーム >> プロジェクトの共用 >> Git >> 作成 ** ローカルリポジトリへコミット [#ob358d6a] + 任意のGitリポジトリーを選択 + 右クリック >> コミット >> src配下のみ選択 + 右クリック >> Init Git Flow + developブランチ⇒masterブランチへ切り替え ** リモートリポジトリへプッシュ [#p045e05a] + GitHubリポジトリー作成 ※「Initialize this repository with a README」にはチェックしない + リモート >> プッシュ >> GitHubの認証情報を入力 ** GitHub + Cygwin 接続設定(参考) [#x6a4c019] - GitHub用に秘密鍵名を変更する(id_rsa => id_rsa.github) $ vi ~/.ssh/config Host github.com HostName github.com User git IdentityFile ~/.ssh/id_rsa.github Port 22 - GitHub接続用の秘密鍵の登録 $ ssh-add ~/.ssh/id_rsa.github - ssh-addができない場合の対処法 $ ssh-add ~/.ssh/id_rsa.github Could not open a connection to your authentication agent. - ssh-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) - .bash_profileに下記スクリプト追記 COLOR(red){※}Cygwin起動時にssh-agentを自動起動しexpectコマンドで対話的にssh-addのパスフレーズを入力 # Start ssh-agent and add authentification keys eval `ssh-agent -s` # SSH key passphrase for Sakura ssh-add /home/y.shimojo/.ssh/id_rsa.sakura # SSH key passphrase for GitHub and Gitlab expect -c " set timeout 5 spawn ssh-add /home/y.shimojo/.ssh/id_rsa.github expect \"Enter passphrase for .ssh/id_rsa.github:\" send -- \"[passphrase]\n\" " - ssh-addの一覧確認 $ ssh-add -l - SSH接続確認 $ 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