Swift Package Manager fails to authenticate when resolving dependencies - xcode

I'm currently trying to set up the work project on the new machine and I've ran into some issues with resolving package dependencies added via SPM. I've copied both private and public SSH keys from my previous machine and added a GitHub account with personal access token in Xcode settings. But whenever I try to resolve package dependencies it almost immediately fails with an error Authentication failed because the credentials were missing and prompts me with dialog asking which GitHub account and SSH key to use. I have only one account and ssh key pair on this machine, so there are no other options to choose from.
Strange enough, it does so only for public repository, which is different every time I try to resolve dependencies, since it is able to clone private repositories (which I have read access to) just fine. It is absurd because running xcodebuild -resolvePackageDependencies not only produces no similar errors, but it also resolves all package dependencies of the project successfully.
I have the exact same Xcode 13.2.1 installed on my previous machine and exactly the same RSA key. The other thing that drives me crazy is that there are no similar issues whatsoever on the brand new Xcode 13.3 released a couple of days ago. It just asks me to unlock the SSH key and then successfully resolves all dependencies. Unfortunately, I couldn't switch to newer Xcode version at the time, so I'm stuck with these SPM issues for now.
Steps I've taken so far to resolve the issue:
Tried generating a new SSH key following this guide from GitHub;
Tried using ECDSA algorithm instead of RSA for ssh-keygen;
Tried resetting package caches;
Tried downloading the same Xcode archive from Apple Developer portal again and again;
After all tried rebooting the machine.
After a day of troubleshooting I was not able to resolve the issue. It is very strange to me that xcodebuild resolves packages with no problem at all, but resolving packages from Xcode throws authentications errors at me.
I would appreciate any help solving this puzzle! Thanks!

Seems like the problem was in combination of my new machine and Xcode 13.2.1. As I mentioned in my question, Xcode 13.3 does not have this issue, so for the past 7 months starting from asking this question, I haven't encountered any problems with SPM whatsoever even on the newer versions of Xcode.

Related

An unknown error occurred: User rejected certificate for github.com (-17) on Xcode 13.3.1

Since updating to XCode 13.3.1 I'm experiencing this error every time I try to add a dependency to a package from Github. I already added my Github account to XCode as Source Control Account but it shows up with a warning triangle. Weirdly enough, I'm able to add the Apple Swift Packages to my project as dependency and they are downloaded from Github.
I really hope someone can help me out with this.
Apparently my AdBlocker blocked the certificates from GitHub and thus making it unable to install packages.
I simply disabled my AdBlocker and everything works fine now!

XCODE: The request was denied... (SBMainWorkspace) for reason: Unspecified

I updated xcode to 10.1 this morning and since then none of my code runs. I am getting the message above (question) which I have researched exhaustively. I have read all the other posts concerning this issue and nothing I have tried seems to work in my situation. The one difference in my message is the reference to "unspecified". I have done the following:
New Provisioning Profile
Automatically managing sign-in
Deleting certain keychain certificates
Project Settings to Legacy
Rebooting/Cleaning
Rebooting Simulator
Mach-O Types to Bundle
Managing/Editing Schemes
Creating new user account on Mac.
New teams/No teams
etc.
(you get the picture!)
I am at my wits end. I have been working on this code for a while and short of wiping my machine and re-installing is there anything else that I can do! I am about to explode!!!
I rebooted the machine and I went back to the Build Settings and changed to Mach-O Type back to Executable and it working ow. Based on all of the previous solutions I have read/tried, this seems about right (unpredictable).

Xcode8 automatic code signing fails with DVTSecErrorDomain Code=-25295

Im trying to use automatic code signing with Xcode8. However this fails with error DVTSecErrorDomain Code=-25295 "The specified keychain is not a valid keychain file."
A similar issue existed with Xcode7, where I finally managed the certificates myself in the . Since Xcode8 gives a more specific error code, I am now wondering if anyone knows how to fix this problem?
I managed to fix this by creating a new "loginn" keychain and making this the new default keychain. (following this)
This fixes the issue but rises new problems with the whole system e.g random apps asking for passwords again, git push not working etc. This is not a good solution

OSX Server 3.2.1 integration build timing out when building sources

I have upgraded to OSX Server 3.2.1 and I am trying to get my bots to work again. I have one of my projects working, but when I have a workspace that tries to build I get stuck at the following message:
Integrating (step 4 of 9)...
Building sources Please wait...
This hanged for about 10 minutes and then fails with the following error:
Bot Issue: error. Build Service Error. Issue: Terminated xcodebuild
since it produced no output for too long.
There aren't any other errors I see in the error logs. Does anyone have any ideas on how to troubleshoot this issue?
The cause of my issue was due to a bug in Xcode server 3.2.1. In the previous version, it read all of its signing certificates from the system keychain. As of 3.2.1, it has its own private hidden keychain. There are 2 workarounds for this:
Override the xcode keychain with your existing system keychain (assuming your system keychain has all of your apps signing certificates already in it)
Install Server 4.0 and Xcode 6.1. Apple has assured me that this is fixed in this version, though I have not tested this without also doing the above step. Additional information is available on the Apple forums here:
https://devforums.apple.com/message/1053902#1053902
I had the same problem, and to fix it, in the target scheme, I've changed the Build Configuration of "Run" and "Analyze" to "Release" and it worked!
My scheme has no target for test, but I have another target with test and it works fine with debug configuration.
In your OS X Server account's Keychain Access app, select your certificate's Private Key and allow access by all applications.
Get Info > Access Control > Allow all applications to access this item
Source:
http://faq.sealedabstract.com/xcodeCI/#signing-for-distribution

Xcode Bot CI Service SVN issues

I am not able to integrate Xcode 5 Bots successfully. I am using https://svn source to access my repository. The Xcode service error log is not that helpful. Did the following so far.
Self signed flag is set to true in the plist.
In the KeyChain the self signed cert is both in 'System' and 'login'.
Tried both Xcode 5.0.2 and 5.1DP
Is there anything that I am missing? Can Xcode service access SVN through https?
Error log attached
http://pastebin.com/jSpzXxQh
Xcode should be able to - generally - but I had problems with it as well. I found a solution with svn+ssh that worked for a while (see) - but then I misconfigured something and it all went away.
I'd suggest to setup a GIT repository clone on a Mac Server (free for devs) and, if needed, sync the GIT with SVN using subgit. Setting it up did not take too long.

Resources