お世話になっております。
今回はgitへのssh接続で質問させて下さい。
■環境
Windows 8.1
SourceTree 1.9.6.1
git 2.8.1.windows.1
■質問内容
gitへssh接続が出来ません。原因がさっぱり分からない為、
原因に心当たりがございましたらご教授頂きたいです。
■現象
・SorceTreeでcloneしようとすると以下のエラーが出ています。
warning: templates not found C:\Users\XXXXX\AppData\Local\Atlassian\SourceTree\git_local\share\git-core\templates Unable to open connection: Host does not existfatal: Could not read from remote repository.
・SorceTreeのターミナルからcloneした場合
ssh: Could not resolve hostname github: Name or service not known fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists.
・ssh接続の確認
$ ssh -vT git@github.com OpenSSH_7.1p2, OpenSSL 1.0.2g 1 Mar 2016 debug1: Reading configuration data /c/Users/XXXXX/.ssh/config debug1: /c/Users/XXXXX/.ssh/config line 1: Applying options for github.com debug1: Reading configuration data /etc/ssh/ssh_config debug1: Connecting to github.com [192.30.253.113] port 22. debug1: Connection established. debug1: identity file /c/Users/XXXXX/.ssh/id_rsa type 1 debug1: key_load_public: No such file or directory debug1: identity file /c/Users/XXXXX/.ssh/id_rsa-cert type -1 debug1: Enabling compatibility mode for protocol 2.0 debug1: Local version string SSH-2.0-OpenSSH_7.1 debug1: Remote protocol version 2.0, remote software version libssh-0.7.0 debug1: no match: libssh-0.7.0 debug1: Authenticating to github.com:22 as 'git' debug1: SSH2_MSG_KEXINIT sent debug1: SSH2_MSG_KEXINIT received debug1: kex: server->client chacha20-poly1305@openssh.com <implicit> none debug1: kex: client->server chacha20-poly1305@openssh.com <implicit> none debug1: expecting SSH2_MSG_KEX_ECDH_REPLY debug1: Server host key: ssh-rsa SHA256:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx debug1: Host 'github.com' is known and matches the RSA host key. debug1: Found key in /c/Users/XXXXX/.ssh/known_hosts:1 debug1: SSH2_MSG_NEWKEYS sent debug1: expecting SSH2_MSG_NEWKEYS debug1: SSH2_MSG_NEWKEYS received debug1: SSH2_MSG_SERVICE_REQUEST sent debug1: SSH2_MSG_SERVICE_ACCEPT received debug1: Authentications that can continue: publickey debug1: Next authentication method: publickey debug1: Offering RSA public key: /c/Users/XXXXX/.ssh/id_rsa debug1: Server accepts key: pkalg ssh-rsa blen 149 Enter passphrase for key '/c/Users/XXXXX/.ssh/id_rsa': debug1: No more authentication methods to try. Permission denied (publickey).
■鍵作成方法
鍵はSorcetreeの「SSHキーの作成/インポート」から秘密鍵(id_rsa)と公開鍵(id_rsa.pub)を作成し、
githubに公開鍵を登録、自PCのpagentに秘密鍵(id_rsa.ppk)を登録しました。
※id_rsa.ppkはid_rsaをコピーして作成しpagentに登録。
■pagentに表示されている内容
ssh-rsa 1024 YY:YY:YY:YY:YY:YY:(以下省略)
■githubのsetting⇒SSH and GPG Keysに登録した内容(pagentと一致しています)
ssh-rsa 1024 YY:YY:YY:YY:YY:YY:(以下省略)
■鍵の場所
Windowsなので、コマンドプロンプトからmkdir .sshにてディレクトリを作成。
C:\Users\XXXXX.sshに、id_rsa、id_rsa.pub、id_rsa.ppkを配置
■configファイル
C:\Users\XXXXX.sshに「config」ファイルを作成。内容は以下です。
Host github.com User git Port 22 Hostname github.com IdentityFile ~/.ssh/id_rsa TCPKeepAlive yes IdentitiesOnly yes
■known_hosts(SSH接続初回時にC:\Users\XXXXX.sshに作成されました。)
github.com,192.30.253.113 ssh-rsa ZZZZZ(以下省略) 192.30.253.112 ssh-rsa ZZZZZ(以下省略)
■その他気になる事
自分で調べている際、とあるHPには以下のレジストにファイルがないとダメという記事が
ありました。
HKEY_CURRENT_USER\SoftWare\SimonTatham\PuTTY\SshHostKeys ・rsa2@22:bitbucket.orgがないとSSH接続できないらしい。
確認したところでは、SimonTathamというフォルダがそもそもない状態です。
そこで、以下のコマンドを.sshのディレクトリから打つと、以下のような
結果となり、登録できませんでした。
XXXXX@JPCBBBBBB MINGW32 ~/.ssh $ "C:\Program Files (x86)\Atlassian\SourceTree\tools\putty\plink.exe" -ssh -C -i "id_rsa.ppk" git@github.com Hi GitHubアカウント名! You've successfully authenticated, but GitHub does not provide shell access. Using username "git". Server refused to allocate pty
いまの状況はこのような形です。本当は会社ではプロキシがありますが、いまは家でプロキシがない状態で
確認しています。まずはプロキシがない状態でssh接続ができるところまで設定したいのですが、
昨日からまったく進捗がないので、質問させて下さい。不足な情報は随時記載を追記していきますので、
ご教授のほど宜しくお願い致します。

回答1件
あなたの回答
tips
プレビュー