Whether you’ve been getting the dreaded “Repository authentication failed” error message in ServiceNow, or you just want to change which Git repository your ServiceNow application is associated with, this article will help you out. I’ll walk you through the steps to properly set up authentication with Github, and configure (or alter) the Git/Github repository your application is linked with.
“Repository authentication failed, check credentials. Make sure the user has both read and write access”
Unfortunately, ServiceNow has made the interesting (see: baffling) decision to make it confoundingly difficult to figure out how to change the Git repo your application is associated with, once it’s been linked to one. I can’t fathom why they might’ve done this, but that is unfortunately not an unusual sentiment when it comes to ServiceNow.
Knowing that I’m liable to let this article devolve into a 10-page ranting, rambling manifesto lamenting the unnecessarily opaque and undocumented process for doing basic things like changing the repo your application is associated with, let’s instead get straight on in to how to do it anyway.
Generating an SSH Key for Github/ServiceNow
If you haven’t already got one set up (such as if your new repo is associated to a new Github account), you’ll need to first generate an SSH public/private key pair. This will allow your ServiceNow instance to authenticate to your your Github account and repositories.
Using a tool such as this one, enter a passphrase and click Generate-SSH-Keys. Save the Public and Private keys somewhere temporarily, and don't forget the passphrase! You’ll need all three of these in a moment.
UPDATE: Github is deprecating the usage of RSA keys, so you’ll want to make sure that you select ECDSA for the SSH-Keygen Algorithm. This uses elliptic curve cryptography and is more secure than RSA.
From Github, click your profile icon and go to Settings.
In the Access section on the left of the page, click on SSH and GPG keys.
Click the green New SSH key button at the top of the page, next to the SSH keys section header.
Give your new SSH key a title like "ServiceNow {instance name}" and paste the Public key into the Key field, then click the green Add SSH key button.
In your ServiceNow instance, navigate to the Credentials [
discovery_credentials
] table, and click New. This will take you to an Interceptor page with a list of options for the credential type.For the type, scroll to the bottom of the list, and click on SSH Private Key Credentials.
Name the credential record something meaningful, so you won’t forget which Github account it corresponds to. Enter your Github username, your Github password, the SSH passphrase, and the SSH private key you generated in step 1.
Save the Credential record.
Changing Your Application Repository/URL
Now that you’ve got your credential record sorted out and linked up with Github, let’s change your application’s repo URL!
Open up Studio in ServiceNow. Commit all changes to your old source control repo, and export your app to XML as a backup -- just in case.
To export your app to XML, follow these steps, then navigate to the Update Set, close it, and click Export to XML in the Related Links UI Actions.
Navigate to the
sys_repo_config
table (you can just entersys_repo_config.list
into the Application Navigator filter bar and press Enter)Find any repo config records that are associated with your application (
sys_app={YOUR_APP_SYS_ID}
).Check the box next to the repo your application is currently associated with, and from the Actions drop-down menu below the list (or above it, if you’re on the new Polaris UI), choose Delete.
You’ll probably be notified that some number of Source Control Branch records will be deleted as well as possibly some Tags and other related records. This is fine.
Open ServiceNow's Application Studio (or refresh the page if you already had it open)
Click the Source Control menu at the top, and you'll see that only Link to Source Control is available. This means the application is no longer linked to your old repo! (That’s good.)
Click Link to Source Control and follow the steps as normal once you have the new Git repo set up.
That’s it! If you found this article helpful, please consider subscribing. We tend to only send out emails a few times a year at most. Feel free to also follow me on Twitter and LinkedIn, if you feel so inclined. I’d love to hear what you thought of this article, and if you have any feedback!
Thanks for reading!
- March 2024
-
February 2024
- Feb 12, 2024 5 Lessons About Programming From Richard Feynman
- July 2023
- May 2023
- April 2023
-
December 2022
- Dec 13, 2022 ServiceNow Developers: BE THE GUIDE!
- October 2022
-
August 2022
- Aug 23, 2022 Using .addJoinQuery() & How to Query Records with Attachments in ServiceNow
- Aug 18, 2022 Free, Simple URL Shortener for ServiceNow Nerds (snc.guru)
- Aug 16, 2022 How to Get and Parse ServiceNow Journal Entries as Strings/HTML
- Aug 14, 2022 New tool: Get Latest Version of ServiceNow Docs Page
- March 2022
- February 2022
- May 2021
- April 2021
- February 2021
-
November 2020
- Nov 17, 2020 SN Guys is now part of Jahnel Group!
- September 2020
- July 2020
-
January 2020
- Jan 20, 2020 Getting Help from the ServiceNow Community
- December 2019
- November 2019
-
April 2019
- Apr 21, 2019 Understanding Attachments in ServiceNow
- Apr 10, 2019 Using Custom Search Engines in Chrome to Quickly Navigate ServiceNow
- Apr 4, 2019 Set Catalog Variables from URL Params (Free tool)
- Apr 1, 2019 Outlook for Android Breaks Email Approvals (+Solution)
- March 2019
-
February 2019
- Feb 27, 2019 Making Update Sets Smarter - Free Tool
-
November 2018
- Nov 29, 2018 How to Learn ServiceNow
- Nov 6, 2018 ServiceNow & ITSM as a Career?
- October 2018
- September 2018
-
July 2018
- Jul 23, 2018 Admin Duty Separation with a Single Account
-
June 2018
- Jun 19, 2018 Improving Performance on Older Instances with Table Rotation
- Jun 4, 2018 New Free Tool: Login Link Generator
-
May 2018
- May 29, 2018 Learning ServiceNow: Second Edition!
- April 2018
- March 2018
-
February 2018
- Feb 11, 2018 We have a new book!
- November 2017
-
September 2017
- Sep 12, 2017 Handling TimeZones in ServiceNow (TimeZoneUtil)
- July 2017
-
June 2017
- Jun 25, 2017 What's New in ServiceNow: Jakarta (Pt. 1)
- Jun 4, 2017 Powerful Scripted Text Search in ServiceNow
- May 2017
- April 2017
-
March 2017
- Mar 12, 2017 reCAPTCHA in ServiceNow CMS/Service Portal
-
December 2016
- Dec 20, 2016 Pro Tip: Use updateMultiple() for Maximum Efficiency!
- Dec 2, 2016 We're Writing a Book!
-
November 2016
- Nov 10, 2016 Chrome Extension: Load in ServiceNow Frame
- September 2016
-
July 2016
- Jul 17, 2016 Granting Temporary Roles/Groups in ServiceNow
- Jul 15, 2016 Scripted REST APIs & Retrieving RITM Variables via SRAPI
-
May 2016
- May 17, 2016 What's New in Helsinki?
-
April 2016
- Apr 27, 2016 Customizing UI16 Through CSS and System Properties
- Apr 5, 2016 ServiceNow Versions: Express Vs. Enterprise
-
March 2016
- Mar 28, 2016 Update Set Collision Avoidance Tool: V2
- Mar 18, 2016 ServiceNow: What's New in Geneva & UI16 (Pt. 2)
-
February 2016
- Feb 22, 2016 Reference Field Auto-Complete Attributes
- Feb 6, 2016 GlideRecord & GlideAjax: Client-Side Vs. Server-Side
- Feb 1, 2016 Make Your Log Entries Easier to Find
-
January 2016
- Jan 29, 2016 A Better, One-Click Approval
- Jan 25, 2016 Quickly Move Changes Between Update Sets
- Jan 20, 2016 Customize the Reference Icon Pop-up
- Jan 7, 2016 ServiceNow: Geneva & UI16 - What's new
- Jan 4, 2016 Detect/Prevent Update Set Conflicts Before They Happen
-
December 2015
- Dec 28, 2015 SN101: Boolean logic and ServiceNow's Condition Builder
- Dec 17, 2015 Locate any record in any table, by sys_id in ServiceNow
- Dec 16, 2015 Detecting Duplicate Records with GlideAggregate
- Dec 11, 2015 Array.indexOf() not working in ServiceNow - Solution!
- Dec 2, 2015 Understanding Dynamic Filters & Checking a Record Against a Filter Using GlideFilter
- October 2015
-
August 2015
- Aug 27, 2015 Easily Clone One User's Access to Another User