Working with two private repos
Hello, I have a small question about working with private repos. I try to use multiple ssh keys here:
jobs:
deploy_some:
runs-on: ubuntu-20.04
steps:
-
name: Setup SSH agent
uses: webfactory/[email protected]
with:
ssh-private-key: |
${{ secrets.SOME_TESTING_2 }}
${{ secrets.SOME_TESTING_3 }}
-
name: Deploy
continue-on-error: false
run: |
git clone [email protected]:dshershov/sometest2.git
git clone [email protected]:dshershov/sometest3.git
And i can see that my first repo downloaded successfully but second repo said about permissions denied:
Run git clone [email protected]:dshershov/sometest2.git
Cloning into 'sometest2'...
Warning: Permanently added the ECDSA host key for IP address 'blah-blah-blah' to the list of known hosts.
total 12
drwxr-xr-x 3 runner docker 4096 Dec 28 16:43 .
drwxr-xr-x 3 runner docker 4096 Dec 28 16:43 ..
drwxr-xr-x 3 runner docker 4096 Dec 28 16:44 sometest2
Cloning into 'sometest3'...
ERROR: Repository not found.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
Error: Process completed with exit code 128.
Logs with prepare ssh agent here:
Run webfactory/[email protected]
Identity added: (stdin) ([email protected])
Adding GitHub.com keys to /home/runner/.ssh/known_hosts
Identity added: (stdin) ([email protected])
Starting ssh-agent
SSH_AUTH_SOCK=/tmp/ssh-UuppDQCueRsO/agent.1757
SSH_AGENT_PID=1758
Adding private key(s) to agent
Key(s) added:
256 SHA256: SOME_KEY [email protected] (ED25519)
256 SHA256: SOME_KEY [email protected] (ED25519)
Configuring deployment key(s)
Comment for (public) key 'ssh-ed25519 SOME_KEY [email protected]' does not match GitHub URL pattern. Not treating it as a GitHub deploy key.
Comment for (public) key 'ssh-ed25519 SOME_KEY [email protected]' does not match GitHub URL pattern. Not treating it as a GitHub deploy key.
Comment for (public) key '' does not match GitHub URL pattern. Not treating it as a GitHub deploy key.
I thought that ssh-keys is being iterated over sequentially or something like that...
Two keys were generated with command ssh-keygen -t ed25519 -a 100
So, could anyone tell me how I can use multiple ssh keys for working with private repos?
Thanks a lot!
Are the repos you’re trying to clone on GitHub?
If so, please read the README section on deployment keys.
i try to create ssh key from this step:
Creating SSH Keys
In order to create a new SSH key, run ssh-keygen -t ed25519 -a 100 -f path/to/keyfile, as suggested in this blog post. If you need to work with some older server software and need RSA keys, tr ssh-keygen -t rsa -b 4096 -o -f path/to/keyfile instead.
Both commands will prompt you for a key passphrase and save the key in path/to/keyfile. In general, having a passphrase is a good thing, since it will keep the key encrypted on your disk. When using the key with this action, however, you need to make sure you don't specify a passphrase: The key must be usable without reading the passphrase from input. Since the key itself is stored using GitHub's "Secret" feature, it should be fairly safe anyway.
Does this section https://github.com/webfactory/ssh-agent#support-for-github-deploy-keys help?