ServiceNow-GitHub: Deploy Keys Setup

This guide walks you through setting up deploy keys to securely connect a ServiceNow instance to a GitHub repository using SSH + ECDSA.

It allows manual code pushes and pulls via Studio Source Control, without using your personal GitHub credentials and granting your ServiceNow instance access only to specific repositories.

Kudos to David Siñuela for telling me about deploy keys!

Prerrequisite: Admin access to the repository is required to add a deploy key.

1️⃣ Generate an ECDSA1 SSH Key Pair

  • Run the following command in your terminal (replace the email with yours).
ssh-keygen -t ecdsa -b 521 -C "name@example.com"
Code language: JavaScript (javascript)
  • Enter the file name in which to save the key: sn_deploy_key (or similar).
  • Set a secure passphrase when prompted.
  • Output:
    • Private key: ~/sn_deploy_key
    • Public key: ~/sn_deploy_key.pub

2️⃣ Add the Public Key to GitHub (Deploy Key)

Go to your GitHub repo:

  • Navigate to Settings → Deploy Keys.
  • Click “Add deploy key”.
  • Fill the form:
    • Title: <your_name>'s deploy key (or similar).
    • Key: Paste the contents of sn_deploy_key.pub
    • ✅ Check “Allow write access”.
  • Click “Add key”.

3️⃣ Load the Private Key in ServiceNow

ServiceNow requires you to store the SSH private key manually before linking to GitHub.

  • Create a new record in the SSH Private Key Credentials [ssh_private_key_credentials] table.
  • Name: GitHub - <your_name>'s private key (or similar).
  • SSH Private Key: Paste the contents of sn_deploy_key.
  • Passphrase: Enter the passphrase you used when generating the key.
  • Add your GitHub User name.
  • Save the record.

4️⃣ Link ServiceNow Studio to GitHub Repo

Follow the process described in the ServiceNow documentation and use the credentials created in the previous step.

Related links

Footnotes

  1. ed25519 won’t work in ServiceNow: Unsupported key type (ssh-ed25519) [latest tested version: Yokohama]:
    {"error.message":"Repository authentication failed, check credentials. Make sure the user has both read and write access","exception.message":"org.eclipse.jgit.api.errors.TransportException: git@github.com:<repository>.git: [ssh-connection]: Failed (RuntimeException) to execute: java.security.NoSuchAlgorithmException: Unsupported key type (ssh-ed25519) in null","exception.class":"com.glide.sourcecontrol.SourceControlException","error.code":"1001"} ↩︎