[Bug] It's impossible to install packages from private Github repos (git+ssh protocol)
See original GitHub issueMy dependencies look like:
"@someorg/somepackage": "git+ssh://git@github.com:someorg/somepackage.git"
I follow this article to set up my MacOS: https://docs.github.com/en/enterprise/2.15/user/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent
In Yarn 1
it works well.
But in Yarn 2
I see so error:
aleksandr@iMac someproject % yarn
➤ YN0000: ┌ Resolution step
➤ YN0001: │ Error: @someorg/somepackage@git+ssh://git@github.com:someorg/somepackage.git: Listing the refs for git+ssh://git@github.com:someorg/somepackage.git failed
at ChildProcess.h.on.n (/Users/aleksandr/WebProjects/someproject/.yarn/releases/yarn-berry.js:2:325427)
at ChildProcess.emit (events.js:198:13)
at maybeClose (internal/child_process.js:982:16)
at Socket.stream.socket.on (internal/child_process.js:389:11)
at Socket.emit (events.js:198:13)
at Pipe._handle.close (net.js:607:12)
➤ YN0000: └ Completed in 5.89s
➤ YN0000: Failed with errors in 5.9s
I.e. Yarn 1
requests my keychain and uses SSH private key but Yarn 2
doesn’t do it.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:4
- Comments:12 (7 by maintainers)
Top Results From Across the Web
Can't install package from private GitHub repository with Yarn ...
Running yarn add git+ssh://git@github.com:adamwathan/my-package ... Same issue as well, though it's a private Bitbucket repo and yarn 1.3.2.
Read more >Unable to install package from private repository #1393 - GitHub
I am attempting to install from a private repository. The output indicates the package and dependencies were installed but when pipenv is ...
Read more >Unable to install from private repo with git+ssh #2653 - GitHub
Issue description I am unable to install package from a private gitlab repo via git+ssh. It works fine with pip but not with...
Read more >It is possible to add a dependency of a private git repo? #835
I've just stated to use poetry, I quite like some of the features, but i'm now stuck since installing a private repo doesn't...
Read more >git+ssh package install does not seem to work #513 - GitHub
No, sorry. It wasn't actually from my personal github though. It's "git+ssh://git@github.com/<org>/<package>.git". The repo is private and I ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@MrEfrem The “git+ssh://” format can still be used in Yarn 2, but others reasons caused this issue.
Thank you so much @arcanis. It’s not a bug of Yarn 2, but I think Yarn 2 may need to help to resolve this problem. While using
git+ssh://git@github.com:someorg/somepackage.git
Yarn 2 will rungit ls-remote --refs ssh://git@github.com:someorg/somepackage.git
to list remote refs, butgit
cannot parse the host correctly, it seems to regardgithub.com:someorg
as the host likehostname + port
, and will output the error message:Adding a slash after the colon(😃 can resolve this problem:
So, we need to use
git+ssh://git@github.com:/someorg/somepackage.git
instead the old version.But I think Yarn 2 need to help users to resolve this problem because:
incorrect
format on there webpages, it’s convenient to copy the URL directly by clicking thecopy
button.package.json
files.It turns out, for my yarn it works best, if I run
yarn install
with the followingpackage.json
configuration:"name": "https://github.com/org/repository"
However, I found this out after running
git ls-remote https://github.com/org/repository
yielded the refs.