我正在尝试使用 R 中的函数(在 Windows 7 64 位上)使用公共 SSH 密钥执行 git 命令system()。当我尝试执行 git 命令时,出现以下错误:
ssh_askpass: exec(rpostback-askpass): No such file or directory
Host key verification failed.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
Run Code Online (Sandbox Code Playgroud)
我可以在命令提示符下运行完全相同的命令并且它可以工作。我还可以在 git bash shell 上运行完全相同的命令并且它可以工作。我不确定为什么cmd使用命令从 R 运行时找不到密钥system()。有没有办法指定命令使用的命令提示符的关键位置system()?
更新:一个不起作用的示例调用:
system("git push --set-upstream git@gitlab.mygit.com:MyGroup/testGitlab.git master")
Run Code Online (Sandbox Code Playgroud)
还
system("git clone git@gitlab.mygit.com:MyGroup/gitLabTest.git")
Run Code Online (Sandbox Code Playgroud)
这两个调用都会出现上述相同的错误。
更新 2:看起来 ssh 密钥在 R 中不可见,使用list.files()
> list.files("C:/Users/Me/Documents/.ssh/", …Run Code Online (Sandbox Code Playgroud)