Skip to content
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

Comment for (public) key does not match GitHub URL pattern #123

Open
gtarabat opened this issue Aug 7, 2022 · 8 comments
Open

Comment for (public) key does not match GitHub URL pattern #123

gtarabat opened this issue Aug 7, 2022 · 8 comments

Comments

@gtarabat
Copy link

gtarabat commented Aug 7, 2022

I get this comment at the the end of the action:

Comment for (public) key 'ssh-ed25519 <redacted>' 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.

Is this a bug? What does it mean?

@Smarker
Copy link

Smarker commented Aug 31, 2022

I got a similar error:

Adding private key(s) to agent
Identity added: (stdin) (github.com:ProjectAussie/pawsit-sdk.git)
Key(s) added:
4096 SHA256:<redacted> github.com:ProjectAussie/pawsit-sdk.git (RSA)
Configuring deployment key(s)
Added deploy-key mapping: Use identity '/home/runner/.ssh/key-<redacted>' for GitHub repository ProjectAussie/pawsit-sdk
Comment for (public) key '' does not match GitHub URL pattern. Not treating it as a GitHub deploy key.

I thought I had added a comment that supported the github regex for my public key when I created the key with: ssh-keygen -b 4096 -t rsa -f key -C "github.com:ProjectAussie/pawsit-sdk.git"

@mpdude
Copy link
Member

mpdude commented Sep 1, 2022

It has to do with deployment key mappings, which are described in https://github.com/webfactory/ssh-agent#using-multiple-keys and https://github.com/webfactory/ssh-agent#support-for-github-deploy-keys.

Comment for (public) key 'ssh-ed25519 <redacted>' does not match GitHub URL pattern. Not treating it as a GitHub deploy key.

This means that key had a key comment, but it does not look like a GitHub repository URL. So, no special configuration is created to make sure this particular key is being used when cloning this particular repo.

It's an informational message intended to help when setting up deployment key mappings.

Comment for (public) key '' does not match GitHub URL pattern. Not treating it as a GitHub deploy key.

That must be a glitch when we go through key comments. Maybe a trailing blank line that was not stripped correctly? Happy to accept patches :-).

If that answers your question, please close the issue.

Thanks!

@mpdude
Copy link
Member

mpdude commented Sep 1, 2022

@Smarker

Added deploy-key mapping: Use identity '/home/runner/.ssh/key-<redacted>' for GitHub repository ProjectAussie/pawsit-sdk

That worked for you, the key should be used for the repo you gave in the key comment.

Comment for (public) key '' does not match GitHub URL pattern. Not treating it as a GitHub deploy key.

That's the glitch, ignore it for now.

@GreenG0blin
Copy link

I got the same issue: When I'm creating a ssh key via: ssh-keygen -t ecdsa -b 256 -m PEM -C '[email protected]:GreenG0blin/repo.git' I got this message:

Comment for (public) key 'ecdsa-sha2-nistp256 <pubkey> (stdin)' does not match GitHub URL pattern. Not treating it as a GitHub deploy key.

When I create the ssk key via ssh-keygen -t ecdsa -b 256 -C '[email protected]:GreenG0blin/repo.git' without pem, it works. But unfortunately I need the key in PEM format. It seems like a bug since in the readme is explicity written, that the key has to be im PEM format: https://github.com/webfactory/ssh-agent#ssh-private-key-format Very confusing ...

@vitalytarasov
Copy link

There is also an issue with the regex pattern used key.match(/\bgithub\.com[:/]([_.a-z0-9-]+\/[_.a-z0-9-]+)/i); - this only works with the official github.com and does not work with the enterprise version hosted at a different domain (e.g. github.mycompany.co.uk.

@sebastiankugler
Copy link
Member

@vitalytarasov there's an extra issue regarding other URLs than github.com, it's #128

@mpdude
Copy link
Member

mpdude commented Sep 28, 2022

@GreenG0blin you might be seeing #93 or a variant thereof.

Not all key formats and/or keys created with various flags/settings actually contain the key comments, but I haven’t fully understood the issue myself either.

@lyager
Copy link

lyager commented Nov 17, 2023

Just wanted to add info from my struggles :) It seems very important (especially on Windows) that the URL in the SSH key comment matches the URL that you want to fetch from. I was using Yarn (NPM for that matter), and the URL started with git+ssh://[email protected]:<....> or just simple ssh://[email protected]<....> in which case ssh-agent was unable to find the correct key. Using simply [email protected]:<....> in Yarn's package.json seemed to get me through the pain.

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

7 participants