XCode 12 - Can't login to Github without Access Token???

Hey,
so I wanted to pull from the Github project repository and XCode asked me login again. Forgot my password so I tried a wrong one and now it keeps asking for my Username and Access token, when I actually just want to login with my password. Doesn't let me choose between the too, not even when adding the account through preferences. Anyone know how to just login with password and the reason for this -pardon me- absolutely idiotic choice of not letting the user choose?

Replies

You need to create a personal access token yourself. Xcode used to do this for you when you logged in, but Github have removed basic auth from their API, so Xcode simply can't do that anymore.
So how can I create that authentication token and then how do I set up my login in Xcode to GitHub to use that token instead of a password which GitHub is deprecating?
To create the personal access token,
  1. Go to GitHub and log in.

  2. In the upper right corner you will see your avatar with a button to open a menu. Click and choose Settings.

  3. Choose Developer Settings from the list of settings.

  4. Choose Personal Access Tokens from the list of developer settings.

  5. Click the Generate a personal access token link.

  6. Enter Xcode in the Note text field to let you know the token is for Xcode.

  7. Select the scopes for the access token.

  8. Click the Generate token button.

  9. Copy the token so you can paste it in Xcode.

Now to use the token in Xcode,
  1. Choose Xcode > Preferences.

  2. Click the Accounts button at the the top of the preferences window.

  3. Click the Add button.

  4. Choose GitHub from the list of accounts.

  5. Click the Continue button.

  6. Enter your GitHub username and personal access token in the text fields.

  7. Click the Sign In button.

Thank you very much! If I’m already logged into my GitHub account through Xcode using a password, do I have to log out and delete that account entry in Xcode and then create a new GitHub account and login with the token or can I just log out of the current GitHub account in Xcode preferences and then log back in with the new access token?
I recommend waiting until Xcode asks you to sign in to GitHub to create the personal access token. I was able to switch to using the token without having to log out or delete the GitHub account entry in Xcode.

I created a new token on Github, removed my existing github account from xcode preferences and added it using the token. In preferences it worked, however everytime I open the "dependencies" I'm asked for a token (e.g. for https://github.com/apple/swift-algorithms.git). I choose my account, enter my token again and the dialogue closes, but pops up after a second. If I enter a wrong token, I get the message "Authentication failed!". If I enter the correct token, the dialogue disappears but comes back. No package is actually added and it seems I'm unable to do so. That's a bummer since it worked before but now I can't proceed with development.

I'm using Xcode 13.2.1

Add a Comment

I have the same problem (constantly asks to introduce access token, I enter it and again appears a token input window). Moreover, token is valid, I successfully login in with it in Xcode on another MacBook. If this is important, I have MacBook Pro M1 Max, MacOS 12.6, Xcode 14.0.1

  • I had a similar issue - I think what's going on is the github download is failing, which results in it re-prompting you for your access token. What made the difference for me, and what isn't mentioned in any of the github token generating steps here or anywhere else, is that when you generate your token, github gives you this display with a ton of check boxes about what your token is supposed to access. Check them all. Then it starts working.

Add a Comment