SourceTree Git Always Asks For Username/Password On Every Push


(Yassine) #1

I am using SourceTree to as my local Git client in Windows, i use 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 my repositories like used to it asks for username & password and after providing them it fails to connect every time and push fails!

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

(Daniel) #2

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.

(1337_BOT) #3

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.

(jms) #4

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

Hope this helps solving your issue.

(Yassine) #5

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-.