github, sourcetree getting unauthorized error

To work with GitHub's two-factor authentication in SourceTree you can simply use your access token instead of your password. The steps to do this are as follows:

  1. Go to your Personal Access Tokens settings in GitHub.
  2. Click on the Generate new token button.
  3. Name the token something descriptive.
  4. Select which scopes you wish to grant this token.
  5. Click the Generate token button.
  6. Copy the token and use it as a password in your hosted repositories.

Source


If your password recently changed, select the repository, go to Tools --> options, go to Authentication tab and delete the stored password. This will make the system request a new password when you next try to connect.

On OSX: go to SourceTree --> Preferences --> Network and delete the default username there.