【发布时间】:2016-06-29 22:08:53
【问题描述】:
我有一个私人 Bitbucket 存储库。 Git 克隆成功:
git clone git@bitbucket.org:user/repo.git
它找到我的 SSH 密钥设置 (~/.ssh/config),要求输入密码(实际上它不识别 Pageant,但我认为它不应该识别)并且一切运行顺利。常见的SSH测试也ok:
> ssh -T git@bitbucket.org
这被重定向到 putty,它找到了 SSH 配置,Pageant 中的密钥并没有问题地登录。如果我使用 Git 的内部 ssh.exe,那么它会找到密钥,但不会找到 Pageant,所以我必须手动输入密码,然后一切都很好。
但是,npm install 失败(省略了一些细节):
> npm i git+ssh://git@bitbucket.org/user/repo.git
npm WARN addRemoteGit Error: Command failed: git -c core.longpaths=true config --get remote.origin.url
npm WARN addRemoteGit at ChildProcess.exithandler (child_process.js:213:12)
npm WARN addRemoteGit at emitTwo (events.js:87:13)
npm WARN addRemoteGit at ChildProcess.emit (events.js:172:7)
npm WARN addRemoteGit at maybeClose (internal/child_process.js:827:16)
npm WARN addRemoteGit at Socket.<anonymous> (internal/child_process.js:319:11)
npm WARN addRemoteGit at emitOne (events.js:77:13)
npm WARN addRemoteGit at Socket.emit (events.js:169:7)
npm WARN addRemoteGit at Pipe._onclose (net.js:475:12)
npm WARN addRemoteGit git+ssh://git@bitbucket.org/user/repo.git resetting remote C:\... because of error: { [Error: Command failed: git -c core.longpaths=true config --get remote.origin.url
npm WARN addRemoteGit ]
npm WARN addRemoteGit killed: false,
npm WARN addRemoteGit code: 1,
npm WARN addRemoteGit signal: null,
npm WARN addRemoteGit cmd: 'git -c core.longpaths=true config --get remote.origin.url' }
npm ERR! ... Cloning into bare repository 'C:\...'...
npm ERR! ... Permission denied (publickey).
npm ERR! ... Could not read from remote repository.
npm ERR! ... Please make sure you have the correct access rights
npm ERR! ... and the repository exists.
npm ERR! Windows_NT 6.3.X
npm ERR! node v4.4.0
npm ERR! npm v3.8.1
如果我克隆 repo,然后在克隆目录中克隆npm install,那么一切都很好——所以这也不应该是问题。 (我猜路径太长也不是问题。)所以,你没用?
【问题讨论】:
标签: git ssh npm ssh-keys npm-install