UnityでPackageManagerからGitHubで公開されているアセットを追加しようとしたら、エラーが出てできなかった。あまり同じ状態の人はいなさそうですが、少しでも参考になれば。根本的な解決方法があったら教えてください。
前提
- Windows 10
- Unity 2021.2.4f1(2020.3.22f1でも同じエラー)
- GitHubにsshを利用している
エラー詳細
[Package Manager Window] Cannot perform upm operation: Unable to add package [https://github.com/xxxx/yyyy-zzzz.git?path=path/path/]:
Error when executing git command. git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
You may need to set up an SSH authentation agent
like `ssh-add` or `Pageant` if your private key is
passphrase-protected. [NotFound].
UnityEditor.EditorApplication:Internal_CallUpdateFunctions ()
[Package Manager Window] Error adding package: https://github.com/xxxx/yyyy-zzzz.git?path=path/path/.
UnityEditor.EditorApplication:Internal_CallUpdateFunctions ()
対応方法
結局色々試したがsshでの接続する際に権限を与える方法がわからず、最終的には一時的にsshでの接続にならないように.gitconfigに入れてあったinstedOfの設定を外して、httpで接続させることでエラーを回避した。
他にやったこと
ssh-add
ssh-addしろとエラーにでているので以下はやってみた。
- eval
ssh-agent
- ssh-add ~/.ssh/xxxxx.key
- ssh-add -l
ssh-add -lして権限が追加できているところまで確認できたが、結局Unityを含め他のconsoleで開いた時もうまく権限を付与できていなかった。うまく行く時といかないときがあるのだが何が違うのかわからなった。
バージョン変更
最初Unityのバージョン問題かと思って、2021、2020の両方で試したが、両方ダメだった。原因を考えたらそれはそうか。
Mac
同じような設定を入れているMacだとうまくいく。Windowsならではの問題なのか?