2

I am struggling to get my Xcode Server working using Xcode 14.2 It used to work, but since having to reset everything I keep getting the error:

Authentication failed because the credentials were missing

I've tried starting from scratch by deleting all Xcode entries from my keychain.

I've created an rsa SSH key as documented here

The cert has been added to my GitHub account as documented here

When I click Edit Bot... in Xcode and select the Repositories tab it successfully loads my repo. Yet when I click to Integrate the bot, it fails with the auth error.

I've tried adding this to my GitHub config but it makes no difference:

[url "ssh://git@github.com/"]
 insteadOf = https://github.com/

What else could I try?

Darren
  • 10,182
  • 20
  • 95
  • 162
  • The host key for github.com has changed recently. See https://github.blog/2023-03-23-we-updated-our-rsa-ssh-host-key/ Maybe you have an outdated key in the Xcode user home directory in `.ssh/known_hosts`. – sakra Apr 07 '23 at 08:17
  • I had already added the new one. I've just tried resetting it by deleting them then doing a `git pull` from the command line which asked me to add the keys. Xcode Server still not playing ball. – Darren Apr 07 '23 at 08:30

3 Answers3

0

I've tried starting from scratch by deleting all Xcode entries from my keychain.

But this thread mentions:

SSH has access to the system keychain so I copied my certificate from the login keychian to the system keychain and that is that.

So check if you need to update your key in the system part of the keychain as well:

KeyChain

The OP confirms in the comments that cleaning up the keychain helped.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • This certainly led me on the right track. I eventually deleted all the ssh entries from my keychain. My suspicion is that it had the wrong password. New additions didn't appear in the keychain until I deleted the old ones. – Darren Apr 08 '23 at 07:13
  • Great, well done. I have included your comment in the answer for more visibility. – VonC Apr 08 '23 at 07:18
  • Unfortunately, although this worked for 1 bot integration my others still have the same issue and nothing I do will make the Auth dialogue appear for them. – Darren Apr 08 '23 at 11:28
0

It seems like you've already tried a few steps to resolve the issue. Here are some additional suggestions you can try to fix the authentication error:

Ensure your SSH key has been added to the ssh-agent: First, start the ssh-agent in the background:

eval "$(ssh-agent -s)"

Next, add your private SSH key to the ssh-agent:

ssh-add ~/.ssh/id_rsa

Replace id_rsa with the name of your private key file if it's different.

Make sure that your SSH key is properly configured in your Xcode bot:

  • Open your bot settings in Xcode.
  • Go to the "Repositories" tab.
  • Click on the repository, and then click the "Settings" button.
  • In the "Authentication" section, select "SSH Keys" and add your private key file.
  • Double-check your Xcode server's Git configuration:
  • Go to Xcode Preferences (Cmd + ,)
  • Select the "Accounts" tab.
  • Find your GitHub account, and click on it.
  • Click on the "Manage Certificates..." button.
  • Check if there's a valid SSH key for your account. If not, click on the "+" button and add the SSH key.
  • Make sure your bot has access to the correct branch:
  • Open your bot settings in Xcode.
  • Go to the "Configuration" tab.
  • Ensure that the correct branch is selected under the "Source Control" section.
  • Check your GitHub repository's SSH URL:
  • Ensure that your GitHub repository is using the correct SSH URL. You can find this URL by going to your repository on GitHub, clicking the "Code" button, and selecting "SSH" under "Clone".
  • Compare this URL with the one in your Xcode bot settings.

If you've tried these steps and are still encountering issues, you may want to consider filing a bug report with Apple or seeking help from the Apple Developer Forums, as the issue could be related to Xcode itself.

RomB6
  • 63
  • 6
  • It's working :) It was a mix between this and @VonC suggestion. I'm thinking my keychain had the wrong password for the ssh cert. I deleted all keychain entries for ssh then when going through your process I finally saw a box that prompted for auth details (This had never appeared before). One of the options was a bot specific cert which I added to GitHub and now it works. I guess having a cert password in the keychain, even if wrong, stops the auth entry box appearing in Xcode. – Darren Apr 08 '23 at 07:12
  • Unfortunately, although this worked for 1 bot integration my others still have the same issue and nothing I do will make the Auth dialogue appear for them. – Darren Apr 08 '23 at 11:28
  • This answer looks like it was generated by an AI (like ChatGPT), not by an actual human being. You should be aware that [posting AI-generated output is officially **BANNED** on Stack Overflow](https://meta.stackoverflow.com/q/421831). If this answer was indeed generated by an AI, then I strongly suggest you delete it before you get yourself into even bigger trouble: **WE TAKE PLAGIARISM SERIOUSLY HERE.** Please read: [Why posting GPT and ChatGPT generated answers is not currently allowed](https://stackoverflow.com/help/gpt-policy). – tchrist Jul 11 '23 at 13:47
0

This issue has become a major effort to handle when trying to acquire the proper authentication credentials but unfortunately there has yet to be any successful ssh commands to apply the necessary authentication credentials in the diagram shown of the keychain access. And yes for almost each keychain needed for your docs or apps, etc will need to be done this way as well.

SnoJr
  • 1
  • 1
  • As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Apr 17 '23 at 13:33