如何解决在Windows 2012 R2上使用child_process / Spawn运行Git Pull时权限被拒绝
我使用these instructions创建了一个ssh密钥,然后能够在Windows Server 2012 R2上使用命令提示符或git bash成功git pull
进行加密。但是,尝试生成child_process并运行git pull时,出现以下错误:
Host key verification failed.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
这是我的代码:
var child = spawn("git",["pull"],{
cwd: "`C:\\path\\to\\repo"
});
child.on('error',function (err) {
console.log(err);
});
child.stdout.on('data',function (data) {
console.log(data);
});
child.stderr.on('data',function (data) {
console.log(data);
});
如果将命令更改为spawn("git",["checkout","master"],...
,则会得到Already on 'master'
,因此我知道cwd
的设置正确。
我正在使用git version 2.16.2.windows.1
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。