GitHub account unavailable on Xcode 10.2

I noticed a strange behaviour in my Xcode (v10.2, running on a 2016 MacBook Pro with macOS 10.14.4). I have most of my projects under source control with a local Git repository. I then create a remote to GitHub via Xcode and commit and push from the source control menu.

Since yesterday every time I committed I got asked for my username and password. At first I thought it was something normal due to some connectivity issue but then the issue persisted and, going to Xcode Preferences > accounts I noticed that my GitHub account was greyed out and, upon selecting it (or trying to) the right side of the window showed this message:

Account Unavailable Your account details could not be loaded because Accountname support is currently unavailable

At this point it is impossible to remove my GitHub account from Xcode in order to add it once more and it is also impossible to add any source control account, as if something with version control in general would be very broken. I thought it an issue with my SSH key for GitHub so I went on and scrapped the old one and generated a new one. The account stayed on "Loading" for a good minute and then the same message presented itself once more.

I really have no idea what to do here.

What is causing this and how do I get out of it?


Solution 1:

This is kind of a tough one to search for but I did find this SO Q&A titled: Xcode source control wrong username on github . There's an answer there that shows the use of a CLI tool called xcrun to manipulate your Github credentials that are stored in Xcode, for eg:

$ xcrun git config --local user.name 'new_user_name'
$ xcrun git config --local user.email '[email protected]'

Might help with getting your issue sorted out.

Xcode 10

I was also able to find reports of people having the same issue as you where their source repos (Bitbucket, Github, etc) were greyed out in Xcode. For eg:

ss1

This reddit thread titled: Add GitHub account greyed out on Xcode 10, can't fix mentions this process for manually deleting out the creds. This appears to be a issue with Xcode 10 itself.

Happened to me, this is the only thing that worked (from StackOverflow):

  • Make screenshots of the custom preference settings
  • Delete /Applications/Xcode
  • Delete all files containing com.apple.dt in ~/Library/Caches
  • Delete all files containing com.apple.dt in ~/Library/Preferences
  • Open App Store.app, download and re-install Xcode.
  • Create the Apple ID developer account

After those steps all account types were enabled and I could create the GitHub account. Finally restore your custom preference settings from the screenshots.

References

Solution 2:

I had a similar problem in Xcode. After updating to Xcode 10.2.1 the "push to remote" checkbox was suddenly greyed out with all my projects. I tried several of the solutions I found online, for example deleting and re-adding all the keychain GitHub entries as well as reinstalling Xcode, but nothing worked.

I believe this is a problem with this version of Xcode and until it is fixed, I found this workaround which allowed me to update my projects on the remote GitHub through the Xcode SourceControl tab as usual.

First, I removed my existing remote repositories from GitHub and added new empty repositories. Then, I deleted all my local git repositories. Once that was done, I opened terminal and went back into my project's folder and ran the following commands.

$ git init
$ git commit -m "Initial Github Recommit"
$ git remote add origin https://github.com/<YOUR_USER_NAME>/<YOUR_PROJECT_NAME>.git


Then, I opened my Xcode project >SourceControl>Commit... and the push to remote checkbox was no longer greyed out and functioned properly.

This worked for me and I hope it is helpful to someone.