webfactory / ssh-agent

GitHub Action to setup `ssh-agent` with a private key
MIT License
1.23k stars 256 forks source link

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

Open dongqiu93 opened 3 years ago

dongqiu93 commented 3 years ago

The actions:

 - uses: webfactory/ssh-agent@v0.5.3
        with:
          ssh-private-key: |
            ${{ secrets.KEY1}} 
            ${{ secrets.KEY2}} 
      - name: Test Pkg Add Pkg1
        run: julia --project=docs/ -e 'using Pkg; Pkg.add(url="git@github.com: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 git@github.com: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="git@github.com:Org/Pkg1.jl.git");'
     Cloning git-repo `git@github.com:Org/Pkg1.jl.git`
ERROR: failed to clone from git@github.com: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?

mpdude commented 2 years ago

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 commented 2 years ago

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

ykomarov94 commented 2 years ago

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

dmoored4 commented 2 years ago

Bumping to see if anybody else has a good workaround?

DilumAluthge commented 1 year ago

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/ssh-agent@v0.5.3
  with:
    ssh-private-key: |
      ${{ secrets.KEY1}} 
      ${{ secrets.KEY2}} 
- name: Test Pkg Add Pkg1
  run: julia --project=docs/ -e 'using Pkg; Pkg.add(url="git@github.com:Org/Pkg1.jl.git");' 
  env:
    JULIA_PKG_USE_CLI_GIT: 'true'