When using multiple keys, only the first one is detected
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?
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
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
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.
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.
https://github.com/webfactory/ssh-agent/pull/238/
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
Bumped into the same issue today, is there a fix planned?
Hello, I had the same issue today :
- name: Setup SSH agent
uses: webfactory/[email protected]
with:
ssh-private-key: |
${{ secrets.DEPLOY_KEY_APP_A }}
${{ secrets.DEPLOY_KEY_APP_B }}