I've got some SPM dependencies which are private Bitbucket repositories to which I have access to. However, when SPM is resolving dependencies, I'm getting an error:
Error while fetching remote repository <my_repository.git>: An unknown error occurred. The requested repository either does not exist or you do not have access. If you believe this repository exists and you have access, make sure you're authenticated. (-20)
The problem boils down to the fact that I have two different Bitbucket accounts with different SSH keys, so apparently SSH protocols tries keys in order, and once finds one that works, it uses that one - sadly, it's not a valid one to authenticate this particular repository.
I had the same error trying to clone the repositories in Source Tree, but I managed to resolve it by having Source Tree create new SSH key (funny enough, there's no way to just chose a different existing key in Source Tree, just create a brand new one)
Is there a way to define which SSH key Xcode should use? Or some kind of global config/setting to tell SSH which key should be used as default?
Edit
Editing ~/.ssh/config
and defining IdentityFile ~/.ssh/key_i_want_to_use
seems to have done the trick, but a global setting doesn't seem optimal. Is there a way to select the key just in Xcode? Ideally, select it per project?