SourceTree / GitHub: Must specify two-factor authentication OTP code

I recently activated two-factor authentication on GitHub, but that started causing an error in SourceTree:

Screenshot of GitHub error: Must specify two-factor authentication OTP code.

Image 1

What that means is that you can no longer use your regular account password to login to GitHub from SourceTree, but have to create a token instead.

You can do this on the application settings page by clicking on the Create new token button and entering a name for the application (e.g. SourceTree). Then copy the token by clicking on the clipboard icon:

Screenshot of GitHub's Application Settings

Image 2

Lastly, simply use that as your user’s password in SourceTree. The error message should now go away and you’re all set.

Leave a Reply

Your email address will not be published. Required fields are marked *