An unknown error occurred. username does not match previous request (-1)

Hey people,

I'm using (or rather trying to use) Swift Packages for my project. This is not about the countless other bumps I found along the road. (Xcode/SPM is still very beta with Xcode 12.0.1 but I'll reserve complaining about for another day). But one I did not even something vaguely useful when googling it.

So I started out using file paths for my dependencies, like:

Code Block
.package(name: "BlaBla", path: "/Users/me/GitDev/BlaBla")


for some reason that does not work when you want to chain dependencies (Another bug to fix, Apple!). So I wanted to change to versions using a git repo. I gave my repo a tag and put in:
Code Block
.package(url: "ssh://me@server.local/usr/home/me/GitDev/BlaBla", from: "0.0.1"),


On the command line SPM has no problem resolving this:
Code Block
 % swift package resolve
Fetching ssh://me@…
Cloning ssh://me@…
Resolving ssh://me@… at 0.0.1


In Xcode though, I get the line from the title:
Code Block
An unknown error occurred. username does not match previous request (-1)

(by the way I have copied this by hand as the message could not even be copy & pasted)

Any ideas how to solve this? Or even debug this any further?

best Roddi
  • @Apple Please resolve this issue as its not working any source control feature in Xcode, as it gets success on command line, This issue is still present in Xcode 13 as it arrived from Xcode 12 initially.

  • Using Version 13.2.1 (13C100) I'll get the same error message from Xcode. Using git from terminal or from Tower works fine

Add a Comment

Replies

Ok, I think I figured it out. It seems like Xcode 12.0.1 has a general problem with git and "ssh://user@…" repos. Neither can I use any of the commands in the Source Control menu nor can I add a dependent package.

…waiting for a fix…

Best
Roddi

Same issue here with Xcode 12.4.
Try in Terminal:

Code Block
defaults delete com.apple.dt.xcode DVTSourceControlAccountDefaultsKey
defaults delete com.apple.dt.xcode IDESourceControlKnownSSHHostsDefaultsKey
sudo killall ssh-agent


  • Same issue in Xcode 13.2.1 Nothing I've tried works, including deleting repo and recloning, moving keys around, clearing defaults like the above, I get the same error in Xcode. Works fine though in command line.

Add a Comment
[core]
	bare = false
	repositoryformatversion = 0
	filemode = true
	ignorecase = true
	precomposeunicode = true
	logallrefupdates = true
[remote "origin"]
	url = ssh://git_user@fffff:22/volume1/code/testddd.git
	fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
	remote = origin
	merge = refs/heads/master

If your git library has an address like this (ssh:://*), push will fail 'username does not match previous request (-1)' This is a very low-level bug, very difficult to experience, xcode 15 version still has this stupid problem**

See https://developer.apple.com/forums/thread/665666, fixed the issue for me. Specially changing to RSA SSH keys.