Yarn can't install ssh+git dependencies

I have a dependency in my build that checks out another project from GitHub. My circleci job has an associated user key, this user has access to both the parent and the dependency. yarn install locally works fine.

// package.json
    "components": "ssh://git@github.com:myorg/components.git#v2.0.0",
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.
Exited with code 1

Any ideas why this is failing, I also tried to add a SSH key under “SSH Permissions” but this didn’t help.
Update: I added the add_ssh_keys step to add my SSH key but it still wasn’t picked up by yarn.


I have recently had a similar issue (I was trying to configure AWS but I assume my problem and yours have this similarity) and was able to resolve it by creating the .ssh directory on the machine and manually creating the credential file that is needs for git integration.

This is how I create the file: command: cd ~ && mkdir .ssh && cd .ssh && touch id_rsa
And then to add the values: echo -e "$PRIVATE_KEY" > ~/.ssh/id_rsa

Where you would need to set your private key, this was a solution I found could set variables in an area that tools like npm and git could find.

I was still using an old version of yarn which had an issue with parsing the ssh formatted URL’s. The image circleci/node:latest works fine.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.