Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

I can't connect to Github from Sourcetree

Agustin Vijoditz March 6, 2014

I tried several times. I even changed my password twice and I still can't login. I'm using the Setup Wizard, my Github username(not my email) and password, and I get the same error:

 

Login error

Login failed for the following accounts:
GitHub: Bad credentials

Do you still want to proceed?

 

I'm able to login with bitbucket with no problems... any ideas?

 

I'm using SourceTree 1.8.1 for Mac under OS X Mavericks 10.9.2

13 answers

1 accepted

10 votes
Answer accepted
Jeff Thomas
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 7, 2014

I think I can recreate a similar error that you're running into (maybe). If I run through the setup wizard with an incorrect password for GitHub and finish the setup wizard, it seems like the incorrect password is getting cached. If I then run the setup wizard again and use the correct password, it won't accept it. Have you run the setup wizard before or is this the first time?

I was able to work around the error by finishing the setup wizard then selecting View > Show Hosted Repositories and choose Edit Accounts. I then set the password for my GitHub account.

Try setting the password outside of the setup wizard and see if that fixes the issue.

Peter Hollingsworth September 28, 2016

Using Mac 2.3.1. Basically did what you suggest via:

  1. Window/Show Remote Hosted Repositories
  2. Then in the popup click the gear and choose Settings,
  3. Then delete the non-working account, click Add Account and re-add with the correct password.
Like # people like this
H. Mijail Antón Quiles September 29, 2016

Using the Mac version 2.3.1, today I still couldn't do this. I had to use the Personal Access Token mentioned by Jonathan.

Like cadabra06 likes this
miguelfor June 26, 2018

...

KimoSovanen November 27, 2020

Deleting the non-working account and re-adding it in the SourceTree options fixed the issue for me in Windows 10! Thankssss!

29 votes
Jonathan Doughty March 26, 2016

On a Mac, with SourceTree 2.2.3 I found that I could work around this by creating a Personal Access Token at https://github.com/settings/tokens , and then use that as the value for the Password for the Protocol: HTTPS in SourceTree's Repository Browser, Remote... Settings... Edit Account dialog.  Jeff's solution didn't work for me.

toddliningerdesign September 8, 2016

This worked beautifully. Thanks.

H. Mijail Antón Quiles September 29, 2016

A tip: when GitHub shows the generated token, there is a small space (less than half a char) just before the token string. If you select the string by dragging with the mouse, you'll probably end up grabbing that space, and since the password field is masked in SourceTree, you won't realize when copy+pasting. This caused me some head scratching.

Of course using the "copy token" icon works beautifully, so maybe use that ;P.

Like 金興基 likes this
Jóhann Sigurðsson July 4, 2017

GAAAH!! That was it !

Steven Vachon January 31, 2018

This is the only thing that worked to correct the repo browser. I still can't push to some private repos, though.

David Rees January 5, 2019

Thanks for tip! FYI, This is needed if two factor authentication is turned on. More info in https://developer.github.com/v3/auth/#working-with-two-factor-authentication.

Alfonso January 23, 2019

That worked for me, many thanks!

Adam April 11, 2019

I, for the life of me couldn't get login to work correctly on Sourcetree with Github - thank you so much for posting this! It actually worked.

Aleksey Matsarski November 14, 2019

Still, have the 403 error. Does anybody know the reason?

brettz9 April 15, 2020

Wasn't at first working for me despite following these steps, but changing the remote URL (Repository -> Add Remote... -> Cancel -> then clicking "Edit" on old URL) to the form `git@github.com:user/repo.git ` (as suggested below) got things working for me.

Not sure whether I also needed this structure (having adapted it from Mac Keychain credentials SourceTree Github), having added "workflow" with the encoded separator "%2C" to the beginning:

access_token=<my token here>&scope=workflow%2Cadmin%3Agpg_key%2Cadmin%3Aorg%2Cadmin%3Aorg_hook%2Cadmin%3Apublic_key%2Cadmin%3Arepo_hook%2Cgist%2Crepo%2Cuser&serviceProvider=GitHub

jquentin June 17, 2021

Can't SourceTree display that more explicitly?

If it's not expecting a password but a token, it shouldn't say "Password".

6 votes
Steven Vachon January 31, 2018

Changing the repository's URL from https://github.com/user/repo to git@github.com:user/repo.git fixed it for me.

Till Simon May 29, 2018

Thanks. Strangely enough, this did trigger a different login popup (with 'git' as username) and using my personal access token as password did the trick (using my regular password would have worked as well I assume).

1 vote
Raquel Geijo September 5, 2018

Hi! I'm having the same problen in W10 with sourceTree V 2.6.10. No Workaround worked for me.

Diego Prananta September 11, 2018

Same here.

I am using Source Tree V 2.6.10. My github has 2 factor authentication enabled as well as SSH connection setup.

Like damcio likes this
1 vote
IriaPoncelaBlanco August 17, 2018

I'm also having this issue, I updated sourcetree to the latest version today, 2.6.10, and Git is on the 2.17.1, and it does not fix it. I read somewhere that there was a fix for an older version but it did not work for me. When is this going to be fixed? ( I'm using a MAC that has windows running)

0 votes
visoor April 8, 2019

Using Basic Login method worked for me, thanks

0 votes
Dmitry Grigansky March 24, 2016

Have same problem, following the tip from Jeff Thomas, helped me fix it.

0 votes
Deleted user December 1, 2015

Hi

I seem to have a similar issue.  Everything was working fine, but this afternoon I updated to v1.6.24.0 (on Windows 7 x64).  I try fetching on a Bitbucket repository, but it keeps asking my password, even after I enter it, it just asks it again as if it is incorrect (but I can login online with the same username and password).

I went to View->Show Hosted Repositories and Edit Accounts, changed the password, the window says Password OK, even try Set Default thereafter, but still, every time I try and access Bitbucket it asks for the password even though I enter it correctly.

Ideas?  Or should I start a new question?

WiaanBeeton December 1, 2015

We're experiencing the same problem after updating to the newest version of SourceTree (three guys in my office). Thinking it's a bug introduced with the update

Stoffe December 1, 2015

We have the same issue at my office. I often experience poor quality when it comes to the source tree client updates. Not only does it often require a re-installation since the auto update almost always fails, updates also tends to introduce new issues rather than solving issues.

Kireet Kokala December 1, 2015

I'm having the same issue after the update

Alan Anderson December 1, 2015

I have the same problem. Just updated and now dead in the water. I went to View->Show Hosted Repositories and Edit Accounts, changed the password, the window says Password OK. I am using github.

Jeff Thomas
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
December 1, 2015

This is a known issue and we're tracking the fix at https://jira.atlassian.com/browse/SRCTREEWIN-3944 Until the fix is released, there are two workarounds available. Workaround 1 Downgrade and install SourceTree 1.6.23 (or an earlier version): http://downloads.atlassian.com/software/sourcetree/windows/SourceTreeSetup_1.6.23.exe. Workaround 2 As a temporary workaround copying the attached Askpass.exe.config file (available on the above bug ticket) in to C:\Program Files (x86)\Atlassian\SourceTree (or the installation folder respectively). This will provide the necessary configuration and should fix the multiple authentication requests.

Deleted user December 1, 2015

Thank you Jeff, was sure somewhere it'd be tracked at least, but couldn't find it. I've opted for Workaround 2 and it works. Have a good day!

IriaPoncelaBlanco August 17, 2018

the first workaround kind of fix it for me, many thanks!

0 votes
ddennis1977 December 1, 2015

Edit: i still have this problem, following Jeff top didn't solve it.

 

This problem still exist. Follwing the tip from Jeff Thomas , helped me fix it

I was able to work around the error by finishing the setup wizard then selecting View > Show Hosted Repositories and choose Edit Accounts. I then set the password for my GitHub account.

 

/Dennis 

0 votes
EPT November 19, 2015

Hi , Is the problem still there? 

marksartbr April 23, 2016

yes

grsudderth June 2, 2016

I see it as well.

Rinto Rapheal June 22, 2016

Still facing the issue.

0 votes
Agustin Vijoditz March 7, 2014

Ok, thanks, now it works!

Tore_Forsgren June 14, 2019

First i tried one thing and then another thing.

Then I finally fixed it.

0 votes
Jeff Thomas
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 6, 2014

Which version of SourceTree are you using and on what platform?

0 votes
Agustin Vijoditz March 6, 2014

Thanks Jeff, I forgot that, I just updated the post with this:
I'm using SourceTree 1.8.1 for Mac under OS X Mavericks 10.9.2

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events