克隆存储库期间纱线失败:权限被拒绝(公钥)

pat*_*ick 12 git npm yarnpkg

我正在尝试使用 Mac OS X 10.12 在我的桌面上本地构建此项目:
https://github.com/lionsharecapital/lionshare-desktop

当我运行纱线时,我得到:

yarn install v0.27.5
[1/4] Resolving packages...
[2/4] Fetching packages...
error Command failed.
Exit code: 128
Command: git
Arguments: clone ssh://git@github.com/prettier/prettier.git /Users/patrick/Library/Caches/Yarn/v1/.tmp/998d9289033d5404a23434d3979d79dc
Directory: /Users/patrick/dev/lionshare-desktop
Output:
Cloning into '/Users/patrick/Library/Caches/Yarn/v1/.tmp/998d9289033d5404a23434d3979d79dc'...
Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
Run Code Online (Sandbox Code Playgroud)

超级困惑,我手动运行git clone ssh://git@github.com/prettier/prettier.git /Users/patrick/Library/Caches/Yarn/v1/.tmp/998d9289033d5404a23434d3979d79d

它工作得很好......那么,当yarn使用git时,它没有使用我的全局git配置?

我怎样才能解决这个问题?

更新

奇怪的是,在另一台计算机上尝试并没有出现此问题,但是安装后,我按照他们的说明进行了操作:

yarn run dev
Run Code Online (Sandbox Code Playgroud)

但我得到:

yarn run v0.27.5
$ concurrently -k 'node desktop/server.dev.js' 'npm start'
[1] module.js:487
[1]     throw err;
[1]     ^
[1]
[1] Error: Cannot find module 'update-notifier'
[1]     at Function.Module._resolveFilename (module.js:485:15)
[1]     at Function.Module._load (module.js:437:25)
[1]     at Module.require (module.js:513:17)
[1]     at require (internal/module.js:11:18)
[1]     at /usr/local/lib/node_modules/npm/bin/npm-cli.js:29:19
[1]     at Object.<anonymous> (/usr/local/lib/node_modules/npm/bin/npm-cli.js:92:3)
[1]     at Module._compile (module.js:569:30)
[1]     at Object.Module._extensions..js (module.js:580:10)
[1]     at Module.load (module.js:503:32)
[1]     at tryModuleLoad (module.js:466:12)
[1] npm start exited with code 1
[0] listening on 3000
--> Sending SIGTERM to other processes..
[0] node desktop/server.dev.js exited with code null
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Run Code Online (Sandbox Code Playgroud)

第二次更新

显然,通过运行yarn,我完全破坏了npm,因为我发现如果我尝试使用npm做任何事情,我会得到同样的错误:

>npm
module.js:487
    throw err;
    ^

Error: Cannot find module 'update-notifier'
    at Function.Module._resolveFilename (module.js:485:15)
    at Function.Module._load (module.js:437:25)
    at Module.require (module.js:513:17)
    at require (internal/module.js:11:18)
    at /usr/local/lib/node_modules/npm/bin/npm-cli.js:29:19
    at Object.<anonymous> (/usr/local/lib/node_modules/npm/bin/npm-cli.js:92:3)
    at Module._compile (module.js:569:30)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:503:32)
    at tryModuleLoad (module.js:466:12)
Run Code Online (Sandbox Code Playgroud)

看来这真是一场灾难啊!

更新3

卸载节点并重新安装并没有解决这个问题,我必须删除 ~/.npm 和 /usr/local/lib/node_modules,然后卸载节点并重新安装,现在 npm 又可以工作了...天啊...知道如何做吗我可以在不破坏我的开发环境的情况下构建这个项目吗?

lma*_*eri 12

For me just doing rm yarn.lock && yarn solved the issue.


小智 10

yarn install使用 ssh-add 代理通过 GitHub 获取私有存储库。您可以绕过并手动运行git clone ssh://....,也可以将 ssh 密钥添加到 ssh-add。首先检查是否没有添加ssh key

ssh-add -l
Run Code Online (Sandbox Code Playgroud)

这里必须显示一个密钥,如果它显示代理没有身份,那么,你需要在这里添加你的ssh密钥。您可以添加使用

ssh-add <path-to-ssh-key>
Run Code Online (Sandbox Code Playgroud)

这样就可以搞定了。


Von*_*onC 2

yarnpkg PR 2384 (yarnpkg 0.19.0 ) 应该已经修复了 ssh URL 的任何问题。
检查 URL 是否不应该

git+ssh://git@github.com:prettier/prettier.git
Run Code Online (Sandbox Code Playgroud)

另外,它似乎是一个公共存储库,因此您也可以尝试使用 https URL:您不需要身份验证来克隆所述公共存储库。

关于第二条错误信息,您可以关注issues kraken-js/issues/79
作为第一个解决方法:

npm install -g update-notifier,
Run Code Online (Sandbox Code Playgroud)