I would like to express my appreciation for the comments here, as it resolved the problem I was having. I could "git clone", "git fetch", "git pull", whatever from the command line using ssh keys while talking to a local server machine just fine, but was unable to get Xcode (12.4 running on macOS 11.2.3) to cooperate. It would complain about its inability to authenticate using the ssh key. The steps here allowed me to resolve the problem, but the steps were scattered about a bit. I thought I might contribute by combining them:
Quit Xcode if it's still running
If still needed, fix your ssh problem (e.g. add your public key to the remote user's .ssh/authorized_keys).
Test git in a shell (not in Xcode). E.g. "cd /tmp ; git clone ssh://remoteuser@host.com/Users/remoteuser/path/repo.git"
(in Terminal...)
$ defaults delete com.apple.dt.xcode IDESourceControlKnownSSHHostsDefaultsKey
$ sudo killall ssh-agent
start Xcode and attempt to clone a project into a temporary directory using your ssh://... URL
After completing those steps, I was able to open the original project which was causing grief in Xcode, and could successfully pull, fetch, whatever.
For the benefit of future Google searches:
xcode git ssh authentication failed because the credentials were rejected
xcode 12 authentication failed because the credentials were missing
xcode 12 authentication failed because the credentials were rejected
xcode git ssh authentication failed, works OK from command line
A minor contribution, but it's a start...
Post
Replies
Boosts
Views
Activity
Uncle!
This worked until I quit and relaunched Xcode, with absolutely no other actions taken between the termination and launch. I'll rely on the command line or username/password from now on, at least until they get the bug fixed.