Search code examples
iosswiftxcodegitswift-package-manager

Xcode 11 SPM authentication failed because no credentials provided


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

Xcode authentication fail

But if I'm using git@github.com: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.


Solution

  • It was a problem with git config. In .gitconfig file it was set to

    [url "git@github.com:"]
        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