Xcode 11 SPM authentication failed because no credentials provided

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


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.

enter image description here


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


you can use ssh URLs instead of https, e.g. [email protected]:ORG_NAME/REPO_NAME.git