Import Application from GitHub using SSH deploy key

echong
Kilo Explorer

Hi,

I am trying import application from GitHub repository using SSH key.  The public key is uploaded to GitHub as deploy key with read/write access.  The private key is imported to ServiceNow as SSH Private Key credential.  I am getting the error "Repository authentication failed, check credentials. Make sure the user has both read and write access" when importing the application.  What is the proper information required?  This are what I used:

Network protocol: SSH

URL: git@github.com:my_username/devtraining-needit-paris.git

Branch: master

MID Server Name: <blank>

Credential: my_ssh_private_key_credential

 

Thanks

 

6 REPLIES 6

Hi Tim,

Can you add a section for the Github deploy keys? It is a bit different than just the SSH API Key-pair. Deploy keys are way more secure because it only gives access to the specific repo, whereas SSH keys give access to all repos.

 

-Dorian

Markus Kraus
Kilo Sage

Hi guys, I was running into the same issue and here is how you fix it.

Note: You have to generate the SSH Key using one of the algorithms know to ServiceNow (ed25519 is currently not one of them).

 

Those are can be seen here:
https://docs.servicenow.com/bundle/rome-servicenow-platform/page/product/mid-server/reference/mid-ss...

I'd suggest you use deployment keys for GitHub Enterprise Server, as fine granular deployment keys are not yet available on this platform (only for GitHub Cloud Platforms):
1.) ssh-keygen -t ecdsa-sha2-nistp521

Filename: deploykey
Passphrase: mypassphrase
2.) pbcopy < deploykey.pub (copies the content of the generated public key into your clipboard)

3.) Open the GitHub Repository > Settings > Deploy Keys

MarkusKraus_1-1680699974743.png

4.) Paste the public key in the key field and choose a title (e.g. ServiceNow SSH Key)

5.) Copy the private key to your clipboard: pbcopy < deploykey

6.) Add a SSH Private Key to the ServiceNow Instance. In the filter navigator: ssh_private_key_credentials.do

You have just enter the name, SSH passphrase and SSH private key

MarkusKraus_2-1680700340516.png