Skip to content

When using multiple keys, only the first one is detected #228

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Pierre-FrancoisHau opened this issue Oct 21, 2024 · 5 comments
Open

When using multiple keys, only the first one is detected #228

Pierre-FrancoisHau opened this issue Oct 21, 2024 · 5 comments

Comments

@Pierre-FrancoisHau
Copy link

Pierre-FrancoisHau commented Oct 21, 2024

Hello, here is what my YAML file looks like:

myTitle:
    timeout-minutes: 60
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v4
    - uses: webfactory/[email protected]
      with:
        ssh-private-key: |
          ${{ secrets.SSH_KEY_ONE }}
          ${{ secrets.SSH_Key_TWO }}

I've tried it with just the first key and just the second key, and they both work. However, when I use two keys at the same time, only one seems to be detected. Is there something I’m missing?

@malyavi-nochum
Copy link

We're having the same issue. Seems like the comments are not saved in deploy keys (anymore?) and so ssh-agent isn't recognizing them

@rupurt
Copy link

rupurt commented Dec 3, 2024

As a temporary workaround if you have 1 new key you can put the new key at the top and it will be used as the default

@paigeadelethompson
Copy link

theres no work around, you just shouldn't use ssh agent this way because they didn't think this through. What I'm gonna have to do is basically add each dependency as a subtree in each repository which really sucks I'm mad about it but whatever do it, don't look back and be done with it.

@mprimi
Copy link

mprimi commented May 8, 2025

Just bumped into this. Same result: whichever key is first is used, the rest seem to be ignored.

Maybe this setup should not be advertised in the frontpage/readme, given that it is known not to work.
More people will bang their head against this.

#238

@mprimi
Copy link

mprimi commented May 13, 2025

Suggested workaround for whoever is reading this: set and use one key at the time.

For example i want to refresh 2 submodules that have 2 different deploy keys. The following seems to work:

      - name: Add SSH key for private submodule A
        uses: webfactory/[email protected]
        with:
          ssh-private-key: ${{ secrets.SUBMODULE_A_KEY }}

      - name: "Update submodule A"
        run: |
            git submodule update --init --remote --checkout --recommend-shallow path/to/A.git

      - name: Add SSH key for private submodule B
        uses: webfactory/[email protected]
        with:
          ssh-private-key: ${{ secrets.SUBMODULE_B_KEY }}

      - name: "Update submodule B"
        run: |
            git submodule update --init --remote --checkout --recommend-shallow path/to/B.git

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants