Stopbyte

Sourcetree keeps asking for username and password

I am using Atlassian SourceTree as my local Git client in Windows, I use it to manage Github and Bitbucket Git repositories.

Recently I decided to install local Git (independent installation) alongside the already existing SourceTree, the installation went smooth and the local git works perfect, but the SourceTree whenever I try to push my code to the repositories as I used to it keeps asking for password and after providing it, it fails to connect every time and the push fails!

P.S. Having both SourceTree and Local Git is critical.

1 Like

I’m not familiar with either, so i’m not sure just how valueable my guess is but we’re here to help, so i’m going to try to do that.

Sounds to me like the data (your log in information) isn’t actually getting through or saved right, there may be an error in the method that provides the access/authority, making it so that you’re not actually validated, this will create a scenario where you’re constantly asked for your details.

Another option may be that you’re actually using the wrong info? Perhaps Caps-lock was on or something when first making the details, and the repeating question to validate yourself is a result of entering the wrong info?

Just a guess from an amateur haha.

Bitbucket will support HTTP/HTTPS to pull data from repositories but Git doesn’t cache the user info on it’s own so that’s why you need to enter them againd and again.

You need to set it up to permanently authenticate them.

If you’re using version 1.7.9 or higher you can use THIS software to do that. Hope that helps.

I had similar issue, i had Bitbucket SourceTree that i used to use to manage my local Github and Bitbucket repositories, but after installing local Git i started getting Git always asking for my username and password on push.

I tried installing different versions (newer & older) of SourceTree but that didn’t work at all, google for long but didn’t work as well, i tried re-creating repositories using different methods (such as SSH) but didn’t work as well, in fact it almost caused me my changes to be lost - so i completely understand your frustration.

So to keep things as short as possible, here are the solutions that worked for me (as i had that problem multliple times on multiple machines):

  1. The best solution is to Uninstall your local Git and install it again (that fixed my problem somehow and i had 0 data loss with it and my repositories in both Git & SourceTree were fine)!

  2. I found on the internet that using SSH instead of HTTPS as repository origin worked for some so you can try that out redirect your local repository to SSH something like this command should work:
    git remote set-url origin [email protected]:username/repo.git

Hope this helps solving your issue.

1 Like

Thanks @jms the first option (reinstalling the local git works perfect for me too) it did really fix my problem.

I believe i do get it now, Bitbucket SourceTree uses it’s own Git installation, and after installing another Local Separate Git things get messy.

So the lesson learned from this: Never install multiple Git installation on the same machines (unless it’s highly required -after all git installations whether it’s on SourceTree or separate it does the same-.