SourceTree basic authentication
Asked by sanan sanan:

Hi,

We have setup Siteminder for the SingleSignOn authentication for Bitbucket. Also, we have created a login form in Siteminder to manage the authentication for the users. It is working absolutely fine for us for logging into Bitbucket from the browser.

But when we try to use SourceTree to clone a repository from Bitbucket. It is creating problem.

We found in SourceTree there is feature to enable basic authentication. We have enabled basic authentication in Siteminder also so that it can accept the login credentials being send via basic authentication.

We tested it by using some curl command to fetch list of repos and projects from Bitbucket and it worked successfully.

But when we try to clone a repository in SourceTree by using basic authentication. it fails.

Though, it is able to create a remote account with basic authentication and is even able to fetch the list of the repositories. But when i try to clone it, it fails by hitting the Sitminder form.

Can someone please help to resolve this problem.

Regards


Answers:
author: minnsey
body: Hi  

As you can see repositories listed and can create repositories from Sourcetree it looks like Sourcetree has stored *good* basic auth credentials.  

However these actions all go via Bitbucket's REST API as HTTP requests.  

The clone however is a Git command. Sourcetree should be sharing the *good* REST credentials with Git.  

Is it possible that the Siteminder and Git are not configured to work together?  

What happens if you try to do a *git clone* from the command line? I'm guessing it will prompt you for credentials, does the clone then work?  

Finally are you using HTTP or SSH/GIT Urls for the Git repositories?

comments: author: sanan sanan
body: Hi Michael,

thanks for your reply.

You have asked very good questions. I will try to answer all of them.

1) Yes, Siteminder has been configurred to accept the basic authentication. i can say this with confirmation because curl command works absolutely fine. And, also sourcetree is able to fetch the list of the repositories. And now I know why. As you said, it uses Rest API and its same the curl command also uses to connect to Bitbucket.

2) We assumed that if Siteminder is set to accept basic authentication it would work for Git clone also. But I guess, i was wrong, it seems Git does not use basic authentication to clone the repositories.

3) Git clone fails from the command prompt. How can we make Git to clone via basic authentication ? No it does not prompt for the credentials. Infact, I even tried by giving username and password in the clone command itself. It looks like it get hit by the Siteminder form as it is not using basic authentication (i think so). Throws following error message:

asked for: https://\<username\>:\<password\>@bitbucket-xx.yyy.zo/scm/dev/sandbox-test-kchri.git/info/refs?service=git-upload-pack  
redirect: https://\<username\>:\<password\>@bitbucket-xx.yyy.zo/login/bitbucket_login.fcc?SMQUERYDATA=-SM-bt2nAKvrjCx2xgVE6AG5aLriC%2fnkl3DweJsVbrnr8O62EoMkO%2baCCgc%2fPt2qAigEkwZg7QG8Esbe7nD%2b2U41v17R6gdBu6WrTVyuXW8xEFzIWYHdZbiDQ0j5mKqKyqlFackvOL4it07Z2OmfIZ2BBEa1KGVwMmccz5urD1FBHTe29ahl36BQ8Jd97b8xjXsqddutzXLDbF3vgslqvpn8aj0gKKjDlAJGM4kcdDNzEf%2f3KF37E5m7aqa7N6ysjzW%2f%2faWrWwgerI4onTxe3pzDvnE7lBee%2fWQLhU3%2fgPFhA%2b7z43XCJVpVG%2fakS5Fo7NyVwSCdMAqafctSnkpv2K3XqN1guw%2fqy%2f%2bJGREdQzFdNVi2pCdq8KvgEeR1AKuMg87QYjbd7h8QyMiUV7PpZ64nvUU7zCxFuV66IioYRDEOboWMCKg4Bjm6gmUT5IIm3nS6fx20v8HSeEdkuL9qJNGLCBfPygXrzxMP

4) We are using https to clone.

Regards


author: minnsey
body: Hi  

I'm glad we've narrowed down the problem, unfortunately I'm not sure how much help I will be beyond here as I have no experience of SiteMinder.  

From the error you posted it looks like Siteminder is receiving on the requests started by Git, but it then trying to forward it to a login screen? It looks like it isn't acknowledging the username and password you prepended to the url.  

As far a I know using HTTP with Git means it **does** just use normal HTTP constructs. As such I'd suggest it is something with your SiteMinder configuration.  

Sorry I can't be of more use.  

When you do find the solution, it would be great for the community f you could re-post it here.


author: sanan sanan
body: Hi Michael,

No problem. Thanks for taking pain to help me. Sure, i will post the solution here, if I get any...

Just a quick question. Do you know if Git uses basic authentication mode or how can we make to use basic authentication?

Regards


author: minnsey
body: As far as I know it does just use standard HTTP processes like the standard Basic Auth authentication header.


author: minnsey
body: I don't know if any of the suggestions here offer any useful guidance?  

<https://stackoverflow.com/questions/2088156/git-through-digest-proxy-authentication>


author: Manju
body: Could you please confirm what version of Sourcetree you are using and what platform (macOS/Windows)?

comments: author: sanan sanan
body: Hi Manjunath,

I am using version 2.3.5.0 of SourceTree on Windows platform. Bitbucket is setup on Linux RedHat.

Regards


Tags: authentication