Permission denied for git dependencies in package.json

1,304 views
Skip to first unread message

Maxim Yefremov

unread,
Jul 8, 2013, 12:23:41 AM7/8/13
to nod...@googlegroups.com

I try setup git dependencies in package.json:

"dependencies": {
    "myLib": "git+ssh://g...@domain.com:user/myLib.git"
  }

When I do sudo npm install I got errors:

Warning: Permanently added the RSA host key for IP address 'myIp' to the list of known hosts.

 Permission denied (publickey).

Allthough I can clone successfully the same lib to that machine:

git clone git@domain.com:user/myLib.git

So I have valid ssh keys.

My os is OsX but I have the same problem on linux. Git repository is bitbucked, but on github have the same problem.

Luke Arduini

unread,
Jul 8, 2013, 1:18:45 AM7/8/13
to nod...@googlegroups.com
It's because you're running with sudo. You should see the same thing if you run your regular clone with sudo. 

Your options are to set up your key to work with sudo, or don't use it when cloning/installing (better option).

This isn't an npm bug at all, fwiw.
--
--
Job Board: http://jobs.nodejs.org/
Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to nod...@googlegroups.com
To unsubscribe from this group, send email to
nodejs+un...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en
 
---
You received this message because you are subscribed to the Google Groups "nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nodejs+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Luke Arduini

unread,
Jul 8, 2013, 1:29:17 AM7/8/13
to nod...@googlegroups.com
If you really want to do this with sudo then make sure your ssh-agent has the key before doing so, but without is better :)

Maxim Yefremov

unread,
Jul 8, 2013, 1:33:08 AM7/8/13
to nod...@googlegroups.com
Thanx Luke, really when I do sudo clone "myRepo"
I have the same error. But I cant do npm install  without sudo:
npm ERR! Please try running this command again as root/Administrator.
How to check key of my ssh-agent?


--
--
Job Board: http://jobs.nodejs.org/
Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to nod...@googlegroups.com
To unsubscribe from this group, send email to
nodejs+un...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en
 
---
You received this message because you are subscribed to a topic in the Google Groups "nodejs" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/nodejs/jU3d1---Kdw/unsubscribe.
To unsubscribe from this group and all its topics, send an email to nodejs+un...@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.
 
 



--
С уважением,
Максим Ефремов

rubyon...@gmail.com

unread,
Jul 8, 2013, 1:36:46 AM7/8/13
to nod...@googlegroups.com
git repo doesn't recognise your local machine, two ways to make it 1) use ssh-keygen to generate key pair and put the public key into server's know_host 2) use https protocol instead of git+ssh
You received this message because you are subscribed to the Google Groups "nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nodejs+un...@googlegroups.com.

Luke Arduini

unread,
Jul 8, 2013, 1:39:56 AM7/8/13
to nod...@googlegroups.com


On Monday, July 8, 2013, Maxim Yefremov wrote:
Thanx Luke, really when I do sudo clone "myRepo"
I have the same error.

Yeah, you should see the error.
 
 But I cant do npm install  without sudo:
npm ERR! Please try running this command again as root/Administrator.
How to check key of my ssh-agent?

You can see the identities in the agent with `ssh-add -l` and add them with `ssh-add [optional key file]` but it's arguably better for you to fix file permissions on your system so you can write wherever you're trying to without escalating. 
 


On Mon, Jul 8, 2013 at 9:29 AM, Luke Arduini <luke.a...@gmail.com> wrote:
If you really want to do this with sudo then make sure your ssh-agent has the key before doing so, but without is better :)


On Monday, July 8, 2013, Luke Arduini wrote:
It's because you're running with sudo. You should see the same thing if you run your regular clone with sudo. 

Your options are to set up your key to work with sudo, or don't use it when cloning/installing (better option).

This isn't an npm bug at all, fwiw.

On Monday, July 8, 2013, Maxim Yefremov wrote:

I try setup git dependencies in package.json:

"dependencies": {
    "myLib": "git+ssh://g...@domain.com:user/myLib.git"
  }

When I do sudo npm install I got errors:

Warning: Permanently added the RSA host key for IP address 'myIp' to the list of known hosts.

 Permission denied 
--
You received this message because you are subscribed to the Google Groups "nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nodejs+un...@googlegroups.com.

Luke Arduini

unread,
Jul 8, 2013, 1:43:58 AM7/8/13
to nod...@googlegroups.com
This isn't true in the least. If he can clone without sudo then github is clearly acknowledging the key.

Furthermore, .ssh/known_hosts is not used for the originating system's public key. You're thinking of the remote server's authorized_keys file.

Maxim Yefremov

unread,
Jul 8, 2013, 3:00:35 AM7/8/13
to nod...@googlegroups.com
Thanx Luke, I changed permissions for node.js apps folder (sudo chown -R `whoami` ~/pathToAll/node/apps) and now can run npm install without sudo and git ssh dependencies works in package.json 


--
--
Job Board: http://jobs.nodejs.org/
Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to nod...@googlegroups.com
To unsubscribe from this group, send email to
nodejs+un...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en
 
---
You received this message because you are subscribed to a topic in the Google Groups "nodejs" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/nodejs/jU3d1---Kdw/unsubscribe.
To unsubscribe from this group and all its topics, send an email to nodejs+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Reply all
Reply to author
Forward
0 new messages