My flutter App depends on a module privately hosted on github.
When I run pub get from Powershell, i get:
Git error. Command: `git clone --mirror ssh://git@github.com:dirkbo/repo-name.git C:\src\flutter\.pub-cache\git\cache\repo-name-123ba`
stdout:
stderr: Cloning into bare repository 'C:\src\flutter\.pub-cache\git\cache\repo-name-123ba'...
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.
exit code: 128
When I copy the failed command and run directly in the same powershell:
git clone --mirror git@github.com:dirkbo/repo-name.git C:\src\flutter\.pub-cache\git\cache\repo-name-123ba
Everything works fine:
Cloning into bare repository 'C:\src\flutter\.pub-cache\git\cache\repo-name-123ba'...
Enter passphrase for key '/c/Users/dirkb/.ssh/id_rsa':
remote: Enumerating objects: 229, done.
remote: Counting objects: 100% (229/229), done.
remote: Compressing objects: 100% (132/132), done.
remote: Total 229 (delta 13), reused 229 (delta 13), pack-reused 0
Receiving objects: 100% (229/229), 19.32 MiB | 1.45 MiB/s, done.
Resolving deltas: 100% (13/13), done.
In my pubspec.yaml I tried:
repo:
git: ssh://git@github.com/dirkbo/repo-name.git
(result see above)
and
repo:
git: git@github.com:dirkbo/repo-name.git
which gives me:
Git error. Command: `git fetch`
stdout:
stderr: 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.
exit code: 128
It seems like the batch command running pub get can't find my ssh key.