How to install git packages.json dependencies with CircleCI node container?

Hello :slight_smile:
In my packages.json dependencies there’s 2 modules I want to fetch during npm install

“dependencies”: {
@myproj/modules1”: “git+ssh://”,
@myproj/modules2”: “git+ssh://”

I created deploy key for both and added add_ssh_keys step to the config.yml, both of keys are installed during the workflow (Can see in logs that the fingerprints installed) but when executing npm intsall I get:

npm ERR! Error while executing:
npm ERR! /usr/bin/git ls-remote -h -t ssh://
npm ERR!
npm ERR! ERROR: Repository not found.
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! exited with error code: 128

looks like module 1 is working ok - but module 2 cannot be fetched (I’m missing something??)

1 Like

Are they private dependencies?

It may help readers to see your config - would you add it, in a formatted block? Thanks.

1 Like

Yes they are private repos, I’ve tried to connect to the circleci container for debugging and found that when trying to ssh -T it replies with
Hi repositoryname! You've successfully authenticated, but GitHub does not provide shell access.
Now the repositoryname is always the first fingerprint in list - and after I checked few times it always fetching successfully the repository with the first fingerprint - any idea ?

Again, may we see your CircleCI config? :slightly_smiling_face:

1 Like

I’m having the same issue. A CircleCI config like this will reproduce it:

version: 2
      - image: circleci/node:12
    working_directory: ~/repo
      - checkout
      - add_ssh_keys:
            - 'FI:NG:ER:PR:INT' # deploy key added to dependency repo
      - run: ssh-add -L # This shows that the key was successfully added
      - run: npm ci # or `npm install` The failure is here
      - run: npm test

and a package.json like

  "name": "project",
  "dependencies": {
    "somedep": "git+ssh://"

Hi, I solved it in the following way,

  1. Create a machine user. (If you don’t have it)

  2. Change git+ssh:// to ssh://