5
8

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Eclipse経由でGitHubへ接続する方法

Posted at

はじめに

WindowsへCygwinのインストール不要。
PowerShellを使って、SSH認証の公開鍵と秘密鍵を作成し、Eclipse経由でGitHubへ接続する方法。

手順

OpenSSHのインストール

  1. PowerShellを管理者権限で起動する
  2. Chocolateyをインストールする 

PS C:> Set-ExecutionPolicy RemoteSigned
PS C:> iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))

  1. chocolateyにてOpenSSHをインストールする

PS C:> cinst openssh

  1. PATHを通す 

PS C:> $Env:Path += ";C:\Program Files (x86)\OpenSSH for Windows\bin"

Chocolaty経由でインストールできるソフト

SSH認証の公開鍵と秘密鍵の作成

  1. コマンド実行

PS C:> ssh-keygen

  1. 鍵の作成場所の指定

PS C:> Enter file in which to save the key (/.ssh/id_rsa): C:\Users\mekagazira-m\.ssh\id_rsa

  1. パスフレーズの指定(未入力で進む)

Enter passphrase (empty for no passphrase):
Enter same passphrase again:

  1. 鍵の確認

PS C:> ls C:\Users\mekagazira-m.ssh

ディレクトリ: C:\Users\mekagazira-m\.ssh

Mode LastWriteTime Length Name
---- ------------- ------ ----
-a--- 2014/12/31 0:25 1671 id_rsa
-a--- 2014/12/31 0:25 409 id_rsa.pub

GitHubへの鍵の登録

  1. GitHubにログインして、[Settings]≫[SSH keys]≫ボタン[Add SSH key]を押下する
  2. 先ほど作成した公開鍵(id_rsa.pub)をKeyの部分に貼り付けて登録する。

PowerShellより登録した鍵のテスト

  1. 以下のコマンドを実行

PS C:> ssh -i C:\Users\mekagazira-m.ssh\id_rsa git@github.com

  1. 以下のメッセージが出れば良いとのこと

PTY allocation request failed on channel 0
Hi mekagazira! You've successfully authenticated, but GitHub does not provide shell access.
Connection to github.com closed.

Eclipseのsshの設定を公開鍵認証方式にする

  1. Eclipseの[ウィンド]≫[設定]≫[一般]≫[ネットワーク設定]≫[SSH2]≫[認証方式]の優先認証方法の選択から、passwordのチェックをはずす

GitHubにrepositoryを作成する

  1. テスト用に「test」リポジトリを作成する

EGitにGitHubリポジトリの設定をする

  1. EGitのGitリポジトリビューの[Gitリポジトリーを複製し、このビューへ追加]を選択する

  2. [URIの複製]を選択する

  3. [URL]へGitHubにて作成した「git@github.com:mekagazira/test.git」をコピペして
    [完了]を押下する

参考にしたサイト

http://wwld.jp/2014/08/14/powershell-openssh.html
http://design1.chu.jp/setucocms-pjt/?p=580
http://qiita.com/t-kashima/items/251acd9ce70ce8929836
設定後に見つけた以下のサイトも良さそう
http://blog.drunkardz.co/2013/07/eclipse-4-3-kepler-%E3%81%AE-%E8%A8%AD%E5%AE%9A-github-wssh-%E7%B7%A8/

5
8
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
5
8

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?