photography of people connecting their fingers

Ever wondered how you could connect a custom app from your instance to your GitHub? Me too and here’s a short step-by-step guide. Because even though this article is pretty clear, it’s still missing few important parts.

Step 1 – create a repository on GitHub

The configuration is up to you – it can be private or public. Name also doesn’t matter. What matters for ServiceNow integration is the SSH URL for the repo. You can get it either from the repo creation screen or later, from the green Code dropdown.

Step 2 – create a RSA key pair

You can’t connect to GitHub repo with your regular username and password. I think it’s the security constraint, every external app needs separate credentials. Anyway, for ServiceNow integration you must use the SSH-RSA key type when creating a new pair. SSH-ED25519 is not supported by ServiceNow (at least in Utah with build tag glide-utah-12-21-2022__patch0-01-18-2023; see my comment to original article.)

I used Ubuntu instance on WSL to generate my pair, you can use whatever you like. Use the command line to type

ssh-keygen -t rsa -C "email_address"

Follow the prompt and you will have your pair generated in seconds. Just remember the 2 files where you saved the keys and the passphrase, you will need it!

Step 3 – add new credentials in ServiceNow instance

Now let’s create a credential record in ServiceNow instance. You will need a private key and a passphrase (those you were supposed to remember 2 sentences ago). On the instance, create a new SSH Private Key credential record and provide a name, password (your passphrase) and private RSA key (all the content from the file with identification). Don’t worry, the key will be immediately masked after saving the record.

Step 4 – add new SSH key to GitHub

Go to your profile’s settings and find the SSH and GPG keys menu section. Click on New SSH key and provide a name and a public key (the contents of the other file you were supposed to remember in step 2).

Step 5 – connect!

Now you have it all set up, it’s time to connect from ServiceNow instance to GitHub repo. On the instance, open the Studio and find your app. From the source control menu at the top, open Link to source control and fill in the form:

The form is pretty self-explanatory and you should have no problems with filling it at this stage. Just remember to use correct SSH URL for your repo.

And that’s it, now you can commit to GitHub directly from ServiceNow instance!

Leave a Reply

Your email address will not be published. Required fields are marked *