ssh-agent icon indicating copy to clipboard operation
ssh-agent copied to clipboard

Deployment key mapping not working with Julia's built-in Package Manager (Pkg)

Open dongqiu93 opened this issue 4 years ago • 5 comments

The actions:

 - uses: webfactory/[email protected]
        with:
          ssh-private-key: |
            ${{ secrets.KEY1}} 
            ${{ secrets.KEY2}} 
      - name: Test Pkg Add Pkg1
        run: julia --project=docs/ -e 'using Pkg; Pkg.add(url="[email protected]:Org/Pkg1.jl.git");' 

Configuring deployment key(s)

Added deploy-key mapping: Use identity '/home/runner/.ssh/key-123456' for GitHub repository Org/Pkg1.jl
Added deploy-key mapping: Use identity '/home/runner/.ssh/key-234567' for GitHub repository Org/Pkg2.jl

When simply running `git clone [email protected]:Org/Pkg1.jl.git" it would work, but when running Julia Pkg.add, it would fail:

Run julia --project=docs/ -e 'using Pkg; Pkg.add(url="[email protected]:Org/Pkg1.jl.git");'
     Cloning git-repo `[email protected]:Org/Pkg1.jl.git`
ERROR: failed to clone from [email protected]:Org/Pkg1.jl.git, error: GitError(Code:ERROR, Class:Net, failed to resolve address for key-123456.github.com: Name or service not known)

It seems like the issue is with deploy-key mapping. Is there a way to stop this deploy-key mapping?

dongqiu93 avatar Sep 17 '21 01:09 dongqiu93

Please see this comment: https://github.com/webfactory/ssh-agent/issues/99#issuecomment-972763597 I added at #99. It might help you to find out if this is a problem with your key setup or the tool (julia?) you're using.

Note that you don't have to put the repo name into the key comment if you don't want the key to be used for a particular repo only.

If you have one key and it works in multiple (or all) repositories, just omit the key comment. That way, no mapping will be set up.

mpdude avatar Nov 18 '21 11:11 mpdude

This is probably about the Julia Language and its package manager: https://docs.julialang.org/en/v1/stdlib/Pkg/

mpdude avatar Nov 18 '21 11:11 mpdude

@dongqiu93 Have you found a solution for this problem? Or maybe some workaround?

ykomarov94 avatar Dec 23 '21 21:12 ykomarov94

Bumping to see if anybody else has a good workaround?

dmoored4 avatar Jun 22 '22 22:06 dmoored4

Could you try setting the JULIA_PKG_USE_CLI_GIT environment variable to true?

So, in your example, you would try something like this:

- uses: webfactory/[email protected]
  with:
    ssh-private-key: |
      ${{ secrets.KEY1}} 
      ${{ secrets.KEY2}} 
- name: Test Pkg Add Pkg1
  run: julia --project=docs/ -e 'using Pkg; Pkg.add(url="[email protected]:Org/Pkg1.jl.git");' 
  env:
    JULIA_PKG_USE_CLI_GIT: 'true'

DilumAluthge avatar Dec 01 '22 04:12 DilumAluthge