Xcode 12b - Push to git repository fails

Hi,

when I try to push to my git repository using Xcode 12 beta, I get the following error:

Code Block
An unknown error occurred
username does not match previous requests (-1)

It works correctly using Xcode 11, using the same copy / files on disk.

Is this a known issue?

Thank you,
Matthias

  • What a pain, but what fixed it for me was:

    Updating VSCodeCreating an SSH keyMove the SSH key to an accessible folder like your user folder "yourUserName/id_rsa.pub" instead of yourUserName/.ssh/id_rsa.pubAfter moving the id_rsa.pub I opened File->Preferences->Accounts, changed to SSH, selected the pub key and entered password
Add a Comment

Accepted Reply

just a quick update, this has now been resolved.
For future reference, this was caused by multiple entries for the same repository in Xcode's user defaults' DVTSourceControlAccountDefaultsKey.
What I did is remove them all and then do a pull for the repository in Xcode.

Replies

still the same in b2
is there anything I could be trying, like resetting Xcode's preferences, or a trick in the command line with xcrun, etc?
filed a bug: FB7899348
pushing via the command line works fine, by the way.
just a quick update, this has now been resolved.
For future reference, this was caused by multiple entries for the same repository in Xcode's user defaults' DVTSourceControlAccountDefaultsKey.
What I did is remove them all and then do a pull for the repository in Xcode.
problem occurs with released version of Xcode 12 also.
I have the same error from Xcode 12.0 (released version), but the difference is that I have no entries in DVTSourceControlAccountDefaultsKey (instead of multiple).

It worked fine in Xcode 11 (with an initial popup asking for my password), and it also still works fine using the git command line. Any help appreciated, because I do not like having to use Terminal for each git push.

git says it is using osxkeychain as credentials helper, in case that makes any difference.
Same problem with XC12 GM.
I tried to suppress DVTSourceControlAccountDefaultsKey from defaults with no success.
Then I
  • commented the [credentials] section in /Applications/Xcode.app/Contents/Developer/usr/share/git-core/gitconfig

  • restarted Xcode

  • and was able to access ONE repository, which recreated an entry in DVTSourceControlAccountDefaultsKey

This repository is now operational. But any other is not, even if it use the same credential. It looks like Xcode 12 has a bug in managing MULTIPLE entries in that key.




problem still occurs with the 12.0.1 update.

I have tried the various suggested workarounds but none of them work for me; although as noted by others the command line git push, pull, clone, etc work ok which indicates that the problem might be related to how the default credential helper (osxkeychain) works?

Any update on the status of your filed bug?
Same problem here. I fixed it by deleting my source control account from Xcode preferences, closing down Xcode, restarting Xcode, and adding my source control account again.
to  ehmjaysee: can you elaborate on what you did? What area of the Xcode preferences are you referring to? Not sure where to look for source control account information in the preferences (it's not in the source control general or git)?

thanks for any help
Fix for me was to set "Default Branch Name" = master (my old git repo uses master not main)

Xcode -> Preferences -> Source Control -> Default Branch Name

Pushing then prompted for username/password
problem still occurs with Xcode 12.1;
I tried fix suggested by curtly42 (changing default branch name to master) but this had no effect on the problem for me.
In terminal in project's directory try to run 'git pull', if it asks for a passphrase for key - then it's my case. Just enter 'ssh-add -K' and try git pull again. It shouldn't ask for a passphrase anymore. Restart Xcode.
Yes, the problem came back for me, too, in b3. Filed another bug report: FB8831714, it's really annoying.

What seems to help intermittently is to go through the steps of cloning the repository (without actually cloning it in the end). It works for the next 1-2 commits, then I have to do it again.