Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

yarn fails during cloning repo: Permission denied (publickey)

Tags:

git

npm

yarnpkg

I am trying to build this project locally on my desktop with Mac OS X 10.12:
https://github.com/lionsharecapital/lionshare-desktop

When I run yarn, I get:

yarn install v0.27.5
[1/4] Resolving packages...
[2/4] Fetching packages...
error Command failed.
Exit code: 128
Command: git
Arguments: clone ssh://[email protected]/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.

Super confused, I manually ran git clone ssh://[email protected]/prettier/prettier.git /Users/patrick/Library/Caches/Yarn/v1/.tmp/998d9289033d5404a23434d3979d79d

And it worked fine... So, some how when yarn uses git, it's not making use of my global git config?

How can I fix this?

UPDATE

Trying this on a different computer strangely did not have this problem, however after installing, I did as their instructions stated:

yarn run dev

But I get:

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.

2nd update

So apparently by running yarn, I broke npm completely, as I discovered if I attempt to do anything with npm, I get that same error:

>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)

This appears to be quite a disaster!

Update 3

uninstalling node and reinstalling did not fix this, I had to remove ~/.npm, and /usr/local/lib/node_modules, then uninstall node and reinstall and now npm is working again... Geez... Any idea on how I can build this project without it breaking my development environment like this?

like image 763
patrick Avatar asked Aug 01 '17 04:08

patrick


People also ask

How do I fix Git GitHub Permission denied publickey this?

Always use the "git" user $ ssh -T [email protected] > Permission denied (publickey). If your connection failed and you're using a remote URL with your GitHub username, you can change the remote URL to use the "git" user. You should verify your connection by typing: $ ssh -T [email protected] > Hi USERNAME!

How do I fix permission denied publickey Fataly could not read from remote repository please make sure you have the correct access rights and the repository exists?

The “Permission denied (publickey). fatal: Could not read from remote repository” error is caused by an issue with the way in which you authenticate with a Git repository. To solve this error, make sure your key is being used on your Git account. If it is not, add your key to Git.

Why do I get permission denied publickey?

"Permission denied (publickey)" and "Authentication failed, permission denied" errors occur if: You're trying to connect using the wrong user name for your AMI. The file permissions within the operating system are incorrect on the instance. The incorrect SSH public key (.

How do I give permission to clone a git repository?

Open Security for a repository To choose another project, see Switch project, repository, team. Open Project settings>Repositories. To set the permissions for all Git repositories, choose Security. For example, here we choose (1) Project settings, (2) Repositories, and then (3) Security.


1 Answers

yarn install uses ssh-add agent for fetching private repos via GitHub. You can bypass and manually run git clone ssh://.... or you can add your ssh key to ssh-add. First, check whether ssh key is not added

ssh-add -l

This must display a key, if it displays the agent has no identities, then, you need to add your ssh key here. You can add using

ssh-add <path-to-ssh-key>

This shall get it done.

like image 127
ShivamS Avatar answered Sep 17 '22 15:09

ShivamS