はじめに
GitクライアントソフトであるSourceTreeを使ってみたくてインストールしましたがGitHubのリポジトリからCloneする際に少しハマったので、備忘録として残しておきます。
状況
GitHubのアカウントは登録できており、GitHubのリポジトリも以下のように見えている状態でしたが、Cloneを選択しても「ソースパス/ソースURLとして正しくありません」と表示され、「クローン」ボタンが選択できない状況でした。
エラーメッセージ
上記「Clone」画面の「詳細」よりエラーメッセージを確認すると以下のように表示されておりました。
コマンド: git -c diff.mnemonicprefix=false -c core.quotepath=false --no-optional-locks ls-remote git@github.com:user/repo.git
出力:
エラー: The server's host key is not cached. You have no guarantee
that the server is the computer you think it is.
The server's ssh-ed25519 key fingerprint is:
ssh-ed25519 255 SHA256:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
If you trust this host, enter "y" to add the key to
PuTTY's cache and carry on connecting.
If you want to carry on connecting just once, without
adding the key to the cache, enter "n".
If you do not trust this host, press Return to abandon the
connection.
Store key in cache? (y/n, Return cancels connection, i for more info) fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
エラーメッセージに書かれている通り、SSH初回ログイン時に聞かれるFingerprintのYes/Noの選択ができずに失敗しているようです。
エラーの内容としては単純なことですが、SourceTreeが内部でどのようにSSHアクセスしているのか分からず、とりあえず「操作」→「ターミナルで開く」のメニューがあったため、ターミナルを起動し、コマンドを実行・・・しましたがエラー内容は変わらず。
plinkでのGitHubアクセス
どうやらSourceTreeは内部でSSHを行う際、plinkを使ってアクセスしていることから、以下のパスにあるplinkでアクセスする必要があるようです。
C:\Users\UserName\AppData\Local\SourceTree\app-3.4.8\tools\putty\plink.exe
plinkからSSHアクセスできれば良いので、操作端末(Windows)のPowerShellを起動し、github.comにアクセスを実施。
PS C:\> C:\Users\UserName\AppData\Local\SourceTree\app-3.4.8\tools\putty\plink.exe git@github.com
The server's host key is not cached. You have no guarantee
that the server is the computer you think it is.
The server's ssh-ed25519 key fingerprint is:
ssh-ed25519 255 SHA256:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
If you trust this host, enter "y" to add the key to
PuTTY's cache and carry on connecting.
If you want to carry on connecting just once, without
adding the key to the cache, enter "n".
If you do not trust this host, press Return to abandon the
connection.
Store key in cache? (y/n, Return cancels connection, i for more info) y
Using username "git".
FATAL ERROR: No supported authentication methods available (server sent: publickey)
途中でYes/Noが聞かれるので「y」を選択。
最後に「FATAL ERROR」が表示されておりますが、Fingerprintの登録を行いたかっただけなので、いったんスルー。
クローン実行
再度SourceTreeの画面よりCloneを選択すると、以下のような画面が表示され、GitHubのSSH鍵の読み込みが行われたため、Putty形式のSSH鍵を読み込ませて「リトライ」で再試行を実施。
Putty形式のSSH鍵が手元にない場合はGitHubで取得したSSH鍵をPutty形式に変換してください。
リトライ後、先ほどGitHubを認識していなかったリポジトリタイプの箇所が無事以下のようになり、クローンも問題なくできました。
おわりに
事象としてはありがちな問題でしたが、SourceTreeのSSHアクセス方法の確認に手間取ってしまいました。
同じようにハマっている方の参考になれば幸いです。





