Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot clone git repository when used as package.json dependency #621

Closed
howarddierking opened this issue Oct 27, 2014 · 10 comments
Closed

Comments

@howarddierking
Copy link

Hi - In my Node project, I'm referencing another project (internally via it's github repository URL). My package.json file looks similar to the following:

{
  ...
  "dependencies": {
    "request": "^2.45.0",
    "underscore": "^1.7.0",
    "my-utils": "git+ssh://[email protected]:my/node-utils.git#dev"
  },
  ...
}

Everything starts working as expected, until npm tries to resolve the git-based dependency. Then I get the following error.

npm ERR! git clone [email protected]:my/node-utils.git Cloning into bare repository '/root/.npm/_git-remotes/git-github-com-my-node-utils-git-3fdbd8e2'...
npm ERR! git clone [email protected]:my/node-utils.git Host key verification failed.
npm ERR! git clone [email protected]:my/node-utils.git fatal: Could not read from remote repository.
npm ERR! git clone [email protected]:my/node-utils.git 
npm ERR! git clone [email protected]:my/node-utils.git Please make sure you have the correct access rights
npm ERR! git clone [email protected]:my/node-utils.git and the repository exists.
npm ERR! Error: Command failed: Cloning into bare repository '/root/.npm/_git-remotes/git-github-com-my-node-utils-git-3fdbd8e2'...
npm ERR! Host key verification failed.
npm ERR! fatal: Could not read from remote repository.
npm ERR! 
npm ERR! Please make sure you have the correct access rights
npm ERR! and the repository exists.
npm ERR! 
npm ERR!     at ChildProcess.exithandler (child_process.js:637:15)
npm ERR!     at ChildProcess.EventEmitter.emit (events.js:98:17)
npm ERR!     at maybeClose (child_process.js:743:16)
npm ERR!     at Socket.<anonymous> (child_process.js:956:11)
npm ERR!     at Socket.EventEmitter.emit (events.js:95:17)
npm ERR!     at Pipe.close (net.js:466:12)
npm ERR! If you need help, you may report this *entire* log,
npm ERR! including the npm and node versions, at:
npm ERR!     <http://github.com/isaacs/npm/issues>

Is there something I need to do on my end to make this work? My assumption was that the same ssh key used to clone the project repo would be used to resolve the npm dependency, but that doesn't seem to be the case here.

thanks,

_howard

@jaredly
Copy link
Member

jaredly commented Oct 27, 2014

Our use of SSH keys is somewhat sandboxed; so the npm install won't have
access to the keys out of the box
On Oct 27, 2014 3:15 PM, "Howard Dierking" [email protected] wrote:

Hi - In my Node project, I'm referencing another project (internally via
it's github repository URL). My package.json file looks similar to the
following:

{
...
"dependencies": {
"request": "^2.45.0",
"underscore": "^1.7.0",
"my-utils": "git+ssh://[email protected]:my/node-utils.git#dev"
},
...
}

Everything starts working as expected, until npm tries to resolve the
git-based dependency. Then I get the following error.

npm ERR! git clone [email protected]:my/node-utils.git Cloning into bare repository '/root/.npm/_git-remotes/git-github-com-my-node-utils-git-3fdbd8e2'...
npm ERR! git clone [email protected]:my/node-utils.git Host key verification failed.
npm ERR! git clone [email protected]:my/node-utils.git fatal: Could not read from remote repository.
npm ERR! git clone [email protected]:my/node-utils.git
npm ERR! git clone [email protected]:my/node-utils.git Please make sure you have the correct access rights
npm ERR! git clone [email protected]:my/node-utils.git and the repository exists.
npm ERR! Error: Command failed: Cloning into bare repository '/root/.npm/_git-remotes/git-github-com-my-node-utils-git-3fdbd8e2'...
npm ERR! Host key verification failed.
npm ERR! fatal: Could not read from remote repository.
npm ERR!
npm ERR! Please make sure you have the correct access rights
npm ERR! and the repository exists.
npm ERR!
npm ERR! at ChildProcess.exithandler (child_process.js:637:15)
npm ERR! at ChildProcess.EventEmitter.emit (events.js:98:17)
npm ERR! at maybeClose (child_process.js:743:16)
npm ERR! at Socket. (child_process.js:956:11)
npm ERR! at Socket.EventEmitter.emit (events.js:95:17)
npm ERR! at Pipe.close (net.js:466:12)
npm ERR! If you need help, you may report this entire log,
npm ERR! including the npm and node versions, at:
npm ERR! http://github.com/isaacs/npm/issues

Is there something I need to do on my end to make this work? My assumption
was that the same ssh key used to clone the project repo would be used to
resolve the npm dependency, but that doesn't seem to be the case here.

thanks,

_howard


Reply to this email directly or view it on GitHub
#621.

@howarddierking
Copy link
Author

hmm - any way to work around this? plugin?

@jaredly
Copy link
Member

jaredly commented Oct 28, 2014

there's a per-project setting to pass the SSH keys in as ENV variables,
which might then be used? or we could modify the node plugin to know
about SSH stuff

On Mon, Oct 27, 2014 at 5:26 PM, Howard Dierking [email protected]
wrote:

hmm - any way to work around this? plugin?


Reply to this email directly or view it on GitHub
#621 (comment).

@knownasilya
Copy link
Member

@howarddierking under the branch config tab, there are two fields for public and private ssh keys, those are the ones that you'd need to populate.

@howarddierking
Copy link
Author

hmm - I had tried registering the public key on github, but it didn't have any effect. I could also try putting in the details from my existing keys to those fields. Ideally, I would like to have the node plugin be aware of the SSH context used to clone the original project repo. This is especially helpful given the pain involved with setting up a private NPM registry.

@knownasilya
Copy link
Member

@howarddierking I recommend starting an issue on strider-node as a feature request.

@howarddierking
Copy link
Author

done - closing this issue. Strider-CD/strider-node#11

@Sridhararshanapally
Copy link

@howarddierking I am also facing the same error with NPM , did you able to figure out ?

@howarddierking
Copy link
Author

Yes, the problem, IIRC, was related to key reuse on GitHub. We ended up using myget.org for private package hosting - has proven to be a reliable solution.

@IshanTiwari007
Copy link

Adding Public SSH Key to my GitHub account and installing the package via NPM through git Bash Worked for me !! Try this if works do let me know !!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants