Skip to content

Unable to npm install private repo via ssh using with ssh-key #195

Open
@RobinBol

Description

@RobinBol

I am trying to setup an action which checks out a git repo which has private npm dependencies (e.g. "my-package": "git+ssh://git@github.com/myOrg/myPrivateRepo.git".

Previously I would use:

- uses: webfactory/ssh-agent@v0.2.0
   with:
      ssh-private-key: ${{ secrets.SSH_KEY }}

Running npm ci afterwards results in a successful installation of my-package.

Now I saw checkout@v2 has its own ssh-key property, so I'd like to use that instead of the webfactory/ssh-agent@v0.2.0 action.

However the following configuration results in a git@github.com: Permission denied (publickey).:

- name: Checkout git repository
   uses: actions/checkout@v2
      with:
         ssh-key: ${{ secrets.SSH_KEY }}
         token: ${{ secrets.PAT }}

- name: Build
   run: npm ci
Full error log
Run npm ci
npm ERR! code 128
npm ERR! Command failed: git clone --mirror -q ssh://git@github.com/myOrg/myPackage.git /home/runner/.npm/tmp/git-clone-60d07701/.git
npm ERR! warning: templates not found in /tmp/pacote-git-template-tmp/git-clone-5994cbe0
npm ERR! git@github.com: Permission denied (publickey).
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! A complete log of this run can be found in:
npm ERR!     /home/runner/.npm/_logs/2020-03-24T10_03_37_383Z-debug.log
##[error]Process completed with exit code 1.

I would expect that the ssh-key option would setup the ssh key in the local git config similar to webfactory/ssh-agent@v0.2.0 but that does not seems to be the case. Anyone an idea what is happening here?

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions