Why do I keep getting a "Repository authentication failed, check credentials. Make sure the user has both read and write access" error message when I create a branch in studio signed in as system admin?

5vetlana
Tera Contributor

I am working on the NeedIt tutorial in the New to Service Now trainings.   Although I was able to do the previous steps I am unable to create a branch in the studio.   The instructions say:

Create a Branch from a Tag

  1. In Studio, open the Source Control menu and select the Create Branch menu item.
  2. Configure the Branch.               Branch Name CreateNeedItApp               Create from Tag: LoadForCreateNIAppModule
  3. Click the Create Branch button.
  4. Click the Close Dialog button.
  5. After the branch is created, the branch name appears in the Studio status bar (bottom right corner).The branch name appears in the status bar on the lower right corner

When I try to run this in studio it fails with the error message "Repository authentication failed, check credentials. Make sure the user has both read and write access'   I have tried to sign in as various users that have read and write access but can't get it to work.   Can anyone tell me what I'm doing wrong?

71 REPLIES 71

Rahul93
Kilo Contributor

Thank you so much! This worked as charm 🙂

Thank you Scott, this have worked for me!

Really straight forward and very useful. Thank you for sharing!

Puru2
Tera Contributor

Worked successfully 🙂

Jesse20
Tera Contributor

This WAS how my repo was previously linked, however something changed either with ServiceNow or Github (again) and SSH was the only route that worked for my situation. I posted this elsewhere, but here's my original in case someone else ends up facing this issue: 

--------

Woot, I got mine working, but the lack of documentation surrounding this issue is astounding. 

Follow these steps EXACTLYhttps://snprotips.com/blog/2022/3/4/how-to-change-servicenow-applications-repositoryurl

The reason I say exactly is because as you will see later, the ServiceNow documentation is outdated when stating, "The Now Platform supports only RSA private keys." - ServiceNow Documentation

A while back when Github updated their security requirements (Improving Git protocol security on GitHub), HTTPS basic auth and DSA keys were deprecated. As for RSA keys, one of the commenters in this Gist states, "the new GitHub rule against using insecure RSA keys - since GitHub no longer supports basic auth or RSA SSH keys", however I cannot attest to the validity of that particular statement and was/still remain too frazzled from troubleshooting this issue to investigate it further. So, although the Github article from above implies that you can still use RSA, I followed the article's advice to opt for better security and used ECDSA 512 when generating my key.

Originally I tried regenerating the O-Auth token and updating the credentials like usual. I also went as far as to completely remove and recreate credentials for this repository. When using the 'Test Credential' UI action, it successfully connected. However, when trying to publish to the application repository it would continually fail with the error: "The repo cannot be accessed. Check URL, username, and password, and confirm user has read, write, and create branch access." The article from SN Pro Tips fixed my issue, so a big thank you to the author, and I hope this post helps future peeps :).