- Post History
- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
on 01-10-2022 09:40 AM
Here's an example of using Studio's source control integration to track your ServiceNow application development via GitHub.
Create Credential
You will need to add a credential to your ServiceNow instance so it can perform actions in your GitHub repositories. If you have already done so, you can skip this step; it is not required that Studio have its own credential.
Add an SSH key to your GitHub account, as in https://docs.github.com/en/authentication/connecting-to-github-with-ssh/adding-a-new-ssh-key-to-your-github-account.
In your ServiceNow instance:
- go to Connections & Credentials->Credentials
- Click "New"
- Select "SSH Private Key Credentials"
- Populate the following fields:
- "Name" - assign a meaningful name
- "SSH Private Key" - must contain the private key contents corresponding to the key you created/added to GitHub above
Create GitHub Repository
In your GitHub account:
- Navigate to the Repositories page. Click "New" and provide a meaningful Repository name.
- Select Public or Private as applicable.
- Click Create repository.
- After clicking "Create repository", ensure that "SSH" is selected in the "Quick setup" section. Copy the SSH URL into your clipboard.
Link to Source Control
In your ServiceNow instance:
- Navigate to your scoped application in Studio. Select "Source Control"->"Link to Source Control".
- Populate the resulting dialog box as follows:
- Network protocol: select "ssh:
- URL: paste the URL from GitHub here
- Branch: generally the default is good here; if you have an alternate branch naming you want to use, update as applicable
- MID Server Name: if you are segregating MID server usage, select a MID with access to GitHub here
- Credential: select the credential you added above
- Click "Link to Source Control"
- Verify the operation is successful; if you do not see success, it is usually helpful to set MID logging to the maximum and retry the operation. Common issues are network connectivity or GitHub permissions.
- 11,427 Views
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Not able to Link to github following your instruction except using midserver. However, my local machine is able to talk to github. So from there i feel something is NOT correct in the ServiceNow side. I will try using midserver and update here.
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
After setting up the midserver, it did work. I see github has moved from basic auth protocol to more secure like SSH private auth, personal token and oauth2.0. This is good.
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
@Will HallamI just tried to follow your instructions and it requires small update - the article at GitHub you posted (https://docs.github.com/en/authentication/connecting-to-github-with-ssh/adding-a-new-ssh-key-to-your...) suggest to use ed25519 type for ssh. However, this doesn't work with ServiceNow credentials, at least in Utah:
{
"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: <secret_repo>: DefaultAuthFuture[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"
}
Adding an RSA type key however is working fine.
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Hi @Ashley , yes I did, the solution is to simply use the RSA key, not the ed25519.
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Sharing my experience in case it helps someone else. I did the above, tested the RSA key on my local machine and it worked, but no matter how many times I tried, ServiceNow would not connect using the Private Key.
The error being logged was:
The repo cannot be accessed. Check URL, username, and password, and confirm user has read, write, and create branch access: com.glide.sourcecontrol.SourceControlException: org.eclipse.jgit.api.errors.InvalidRemoteException: Invalid remote: origin: com.glide.sourcecontrol.AGitRepository.loadGit(AGitRepository.java:234)
I eventually created a Fine Grained Personal Access Token and that did work (to my surprise). I followed most of the instructions here.
The SSH Key had Read/Write access, not sure what the problem was.
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
This tutorial might help as well:
https://www.youtube.com/watch?v=MhtEDG-wiJs&ab_channel=HasnainMirza

- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
You should use this support article to create a Github credential:
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
After pouring over the developer forum and trying out multiple suggested solutions, finally got this working using the Fine Grained Personal Access Token as suggested by @davidglover (thanks!)
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Thanks @davidglover @Will Hallam
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Do this:
Go to github.com, sign in.
Navigate to "Settings" under the user menu.
Navigate to "Developer"
Create a new token under the Personal Access token either Fine grained or Classic.
Enter the created token as the password within the credentials used for GitHub in ServiceNow
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
This article gives very detailed instructions on how to link a studio app to GitHub: https://developer.servicenow.com/blog.do?p=/post/backup-your-pdi/
You can also follow along using this video tutorial: https://www.capcut.com/s/Cc3aaJZ1avC34yMn/
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Creating a classic token within my Github account and using this token as a password for ServiceNow connection worked well for me. Note: even though you use a token, it is still a https network protocol, not ssh.
Go to Settings -> Developer settings -> Personal access tokens -> Tokens (classic)