-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Can't install package from private GitHub repository with Yarn but can with NPM #4360
Comments
This seems related to #4302 and isn't a problem in Also, it looks like the pre-existing |
diff --git a/package.json b/package.json
index 9ded77ada..2bdfc80f0 100644
--- a/package.json
+++ b/package.json
@@ -82,7 +82,7 @@
"node-nconf-config": "^1.0.3",
"node-notifier": "^4.1.1",
"object-assign": "^2.0.0",
- "our-node-stuff": "git+ssh://github.com/influentialpublishers/our-node-stuff.git#0d91067",
+ "our-node-stuff": "git+ssh://git@github.com/influentialpublishers/our-node-stuff.git#0d91067",
"proxy-middleware": "^0.15.0",
"pug": "^2.0.0-beta3",
"pug-loader": "^2.3.0", It seems that our git string was incorrectly configured. notice the lack of |
Are you able to re-test this on Yarn v1.2.1? I just tried a private Github repo using the same URL format on v1.2.1 and it worked. (on OSX) |
@scull7 seems to have found the issue. Git itself doesn't support the URL without the
I suspect NPM must do something to "fix" the URLs for you, but using a proper git URL would be ideal here. I'm not sure if Yarn should attempt to fix an improper URL. More discussion needed here... After some poking around in the NPM source, I think they use https://github.com/npm/normalize-git-url to "fix" their URLs, however:
So the normalization just removes the leading
so I'm not really sure how NPM handles this... 😕 |
@rally25rs, I don’t believe this is a yarn issue. I think NPM is wrong in that it will accept an invalid configuration. Perhaps a highlighted note in the documentation, and a better error message would be the best approach? |
For what it's worth, without the |
Hey ! I don't know if this can help but I had the same issue for few days now. To solve it, here is what I did:
Looked like a weird connexion issue somewhere... |
We already do some normalization/massaging in Lines 86 to 122 in aa1e54d
I think it is reasonable to add well-known services there such as GitHub, BitBucket and GitLab and default to Thoughts @Daniel15 @rally25rs? |
The only "catch" is when people actually want to omit the username/auth part but I've just checked |
I can confirm that modifying the URL to include However, the steps outlined in this comment resolved the issue for me: #686 (comment) |
@BYK I'm not opposed to adding If we can add back in the |
@rally25rs, why not just add a better error message with a helpful link? Or if yarn adds the |
@scull7 the output is the actual output from the Git command, so it's as clear (or not as clear) as they made it. It isn't Yarn's error message. We might be able to capture exit code |
@rally25rs the git error is clear about the permissions failure. I’m suggesting an augmentation to point the user into a better why direction. So, yes, if capturing the error code is possible then it would be good to provide some solution direction similar to Elm’s compiler. |
solution mentioned in #3942 by using |
I am getting this error and none of the solutions above have helped My scenario might be different from others though as I am on engineyard and using rails webpacker and yarn |
In my case, it was due to passphrase , my SSH Keys generated using passphrase and it was throwing "Permission Denied" (Public Key) error, I re-generated the ssh keys without passphrase and tried again and got it working. |
I am having this issue too. |
Had, same problem. Keys were not added to do ssh-agent for the user i was running it with. @UmamaheshMaxwell would not recommend running keys without password. |
ssh-add -K worked here |
Ran into this issue with a coworker, turned out it was a mismatch between his username on his machine, and his username in Bitbucket. Solved via adding a
|
I also ran into this issue trying to get a site running in homestead. For me it seemed to be the fact that there is no entry for bitbucket in my known hosts. I ran this command first and it seemed to fix the issue for me.
Likely opens me up to some man in the middle or something but it seems to work. |
Anyone has figured it out on Windows? Git's SSH Agent seems to suffer from sclerosis. I have to run Edit: even in the same terminal it seems to forget the SSH key after ~30 minutes. |
ssh-add -k for windows 10. Thanks. |
This worked for me. |
It seems you try to add remote package via sudo. But you have key of your user. But by trying with sudo you need similar key of root user, not your. |
this worked for me too |
I had the same issue. |
just had it today. I moved from home mac to work mac. Suddenly got ssl errors on yarn start.. |
This link in Github Docs is very helpful for me: https://docs.github.com/en/github/authenticating-to-github/error-permission-denied-publickey#make-sure-you-have-a-key-that-is-being-used
|
Remove yarn.lock file after run yarn install |
This can actually be a problem with yarn not being able to find your ssh public key, usually yarn uses your public key even to install packages so you need to add your ssh key with ssh-add "path-to-your-ssh-public-key" and then try to install it again. |
if this doesn't help try checking your public key with pbcopy < ~/.ssh/id_rsa.pub (which copies your ssh public key to clipboard) and pasting it somewhere and compare it with the one you pasted in your github account ssh public keys it should match and should have your email that you registered to your github account at the end after " = " sign for example "ADAQABAAABgQDGF0pWlJiovfnfDM3uk4jek1F1BXYy/0Kq+FqD24JIhn17bhk7MCAml4qoFpc3XtmAlRNDrtEeJ84KwP8WTOhs75ZnSfZvESf4YwOUM40GSymiHIN1BYapT+Po21c8eL3x2445v0LpACev1amFKewWqx5BHqXJ9HO1usCTiWo9m4/KfBHDa339G888zkniID14IdpkvsylH4tDTdYSv60Si4Xzw5XvMa80KY/GOvmxP4nmR+NVtwKCO4lfrOyADvy1NDuyF5M374zFN0vczdp4OWKen2ofpRJRMDdz8mC8F9JLGpLjM6iLSs7q4XCitaOhskLmDsdfaCdUce+kNEwasdfLUgP5hWasdfHZrL3/ncbuHqZuKqHJSnCBNbifyPidcz3HOOwOvts3cuf5JOkPmwAasdfNZs44GX4SIgZg7nzdLg2b9fQdY+rE2TarKLVnvOm+J4u1NQ3tATaiDnUbBGOkIEzKkrOmNIr6B3OQosSn8WJGzqVgIIrPSQc/QCEeKsd5xOzW8uGuVH0= youremail@test.com" |
In my case, my ssh key was generated years ago and is not "strong" enough nowadays, so I can |
Do you want to request a feature or report a bug?
Bug
What is the current behavior?
Running
yarn add git+ssh://git@github.com:adamwathan/my-package
results in a "Permission denied (publickey)" error:I can
git clone
this repo without any trouble, and adding via NPM works fine:What is the expected behavior?
The package is installed without permission issues.
Please mention your node.js, yarn and operating system version.
Node 8.4.0
Yarn 1.0.1
macOS Sierra 10.12.4
The text was updated successfully, but these errors were encountered: