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:
ssh-keygen
;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.