Xcode 11 SPM authentication failed because no credentials provided
It was a problem with git config. In .gitconfig file it was set to
[url "[email protected]:"]
insteadOf = 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.