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

Multiple keys not working

Open florin-lazau opened this issue 1 year ago • 2 comments

I have a React project that has two private repositories as dependencies. I created two SSH keys, added private keys as secrets and added public keys as deploy keys in the dependency repository.

This is the code from the pipeline

      - name: SSH
        uses: webfactory/[email protected]
        with:
          ssh-private-key: |
            ${{ secrets.SSH_PRIVATE_KEY1 }}
            ${{ secrets.SSH_PRIVATE_KEY2 }}

For some reason, the connection works only for the first key. I have tried putting SSH_PRIVATE_KEY2 first, and it worked for the repository that has SSH_PRIVATE_KEY2 public key counterpart, then I put SSH_PRIVATE_KEY1 first, and it worked for the repository that has SSH_PRIVATE_KEY1 public key counterpart.

Is someone else having the same issue?

florin-lazau avatar Apr 21 '23 10:04 florin-lazau

Yep, also having no luck. Even after following steps here to align git config and ssh config. I can clearly see by executing:

RUN --mount=type=ssh GIT_SSH_COMMAND="ssh -v" pip install git+ssh://[email protected]/owner/repo-b

that it is still trying to use the public deploy key from repo-a to authenticate to github for repository b. Really frustrating - been stuck on this for literally days and I think I'm as far as I can go.

tompiler avatar May 06 '23 19:05 tompiler

I seem to be experiencing the same problem. I think it may be related to new GH keys as discussed in v0.8.0

Single keys work, multiple not. I'm considering to try @shaunco 's fork

The PR of which was rejected: https://github.com/webfactory/ssh-agent/pull/38

More detail on his solution: https://github.com/webfactory/ssh-agent/issues/30

PeteDevoy avatar May 24 '23 07:05 PeteDevoy