eijenson Con

主に作業中にはまったことの作業ログを書いていきます。

Windowsにて、SourceTreeでcloneしようとしてエラーになった時の対処法

Macの方でも使っているSourceTreeでCloneしようとしたら結構てこずったのでメモする

環境

  • Windows10
  • SourceTree:2.5.5.0
  • GitHubにレポジトリがある
  • sshでcloneしたい

エラー文

コマンド: git -c diff.mnemonicprefix=false -c core.quotepath=false ls-remote git@github.com:tyutyu08/connpass_searcher.git
出力: 
エラー: Server refused our key
FATAL ERROR: Disconnected: No supported authentication methods available (server sent: publickey)
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
  • 検索したら「SourceTreeから再生成すればできるよ」との記事がいくつか見つかったけど、できなかった
  • GitBashでCloneしてみると以下のエラーが発生
    • Permission denied (publickey).
  • 調べるとGitHubに方法が書いてあった
  • GitBash上で作りなおしたキーを使うとCloneできた。
  • 後はSouceTreeの設定で、「ツール→オプション→全般→SSHクライアントの設定」で
    • SSH キー:作り直したキー
    • SSH クライアント:OpenSSH に変更したらFetch等レポジトリ操作ができるようになった。