Xcode 11 SPM authentication failed because no credentials provided
Solution 1
It was a problem with git config. In .gitconfig file it was set to
[email protected] "https://github.com/:
After removing this section https worked correctly
EDIT: as mentioned in comments you can easily access your gitconfig in terminal with command: git config --global --edit
Solution 2
In my case with Xcode 11.3.1 I had the same problem and I solved changing de auth method to SSH from HTTPS in Github account preferences on Xcode.
Solution 3
Building off of two previous answers, I solved this by doing what Abrahanfer did, setting Clone using
to SSH
in Xcode Preferences -> Account
.
Then I used the SSH url of the repo, for example: [email protected]:AppPear/SwiftUI-PullToRefresh.git
Solution 4
you can use ssh URLs instead of https, e.g. [email protected]:ORG_NAME/REPO_NAME.git
Solution 5
I double clicked the error message Error while fetching remote repository: [email protected]:ORG/REPO-NAME.git
or the The server SSH fingerprint failed to verify
in Xcode's Report Navigator which then a popup appeared asking if I wanted to trust the host. After clicking that I was able to add the Swift Package using SSH.
Selecting HTTPS or SSH in the Xcode Preferences did not fix for me because Xcode seems to automatically handle SSH GitHub URLs in the SPM flow.
Simonas Daniliauskas
Updated on June 16, 2022Comments
-
Simonas Daniliauskas almost 2 years
I started using Swift package manager and when I add repository with https (https://github.com/Alamofire/Alamofire.git) address authentication always fails when I try to login with my github account
But if I'm using [email protected]:Alamofire/Alamofire.git it will get added successfully. I tried regenerating new key, deleted .ssh directory but nothing makes https work and I still get xcode authentication failed because no credentials were provided error. I could use locally ssh url but in CI I need one with https.