Every Interaction has HttpRequestExeption Error
Asked by XV:

Greetings,

Have a new repo and configured with LFS. I've been able to do normal git operation to clone, add, commit, push, etc... and I get the the expected results so far. However, there is always a complaint in the details that seems to be associated with LFS but I'm not sure. A sample of the error message follows here:

```
git -c diff.mnemonicprefix=false -c core.quotepath=false -c lfs.customtransfer.bitbucket-media-api.path=git-lfs-bitbucket-media-api push -v origin refs/tags/FUS
fatal: HttpRequestException encountered.
?? An error occurred while sending the request.
```

Other detailed entries regarding git operations have no errors so the the core git functions are fine. I'm using ssh auth and there are no complaints with SourceTree or shell based repo interactions.

I'm reluctant to just keep plugging along even though things "seem" to be working fine just to get bitten down the road. Sincere thanks in advance for any advice.

Best regards,

XV


Answers:
author: minnsey
body: Hi  

I believe that error is coming from the Git Credential Manager. You can try and confirm that by running the same command in the Terminal/Command line, first having set the following environment variable   

GCM_TRACE=1  

And then post up the trace?  

Can I check which git host you are using Bitbucket, GitHub etc?

comments: author: minnsey
body: I've done some more testing. I can reproduce similar behaviour if I'm using a Git install that includes a broken Git Credential Manager for Windows (GCMW), essentially v1.16.1 and v1.16.2.  

Sourcetree can detect the broken versions of Git Credential Manager and force the use of a working copy, v1.17.1, using the following parameters with Git calls  

```
-c credential.helper= -c credential.helper="C:/Users/mminns/AppData/Local/ATLASS~1/SOURCE~1/GIT_EX~1/GIT-CR~1.EXE"
```

<br />

However I suspect this override isn't being carried through to git-lfs which is then calling Git without the overrides and uses the broken Git Credential Manager which fails to authenticate.

Until the fixed version of Git Credential Manager is shipped with a new Git for Windows release which is bundled with a new Sourcetree release please use the following work around.  

**Work Around**

* Install a standard copy of Git 2.18 from <https://gitforwindows.org/>
* Install Git Credential Manager for Windows 1.17.1 <https://github.com/Microsoft/Git-Credential-Manager-for-Windows/releases/tag/v1.17.1>
* Switch Sourcetree to use the installed Git 2.18/GCMW 1.17.1 in the *Tools/Options/Git* tab and click the *Git version/System* button


author: XV
body: 1) thank for digging in on this - really appreciate your effort/support

2) using bitbucket

3) if I've followed directions correctly, after setting GCM_TRACE=1, I executed the command that appears in the logs that generates the complaint and I initially get the following

```
fatal: HttpRequestException encountered.
?? An error occurred while sending the request.
```

and then am prompted for my bitbucket password twice. I respond with my bitbucket password and the command continue and succeeds. Let me know if this is what you were looking for.

4) Could use a little more coaching on the work around proposed as the GCMW-1.17.1 installer insists on installing git 2.17.0. The manual install instructions using the zip don't have a case for an existing version of git. Do you have any advice?


author: minnsey
body: The .exe installer for the GCM should find any git installs in the PATH or the standard program files locations. It only offers to install Git if it can't find it. I'm guessing you have installed in a different location?  

You can re-direct the installer to your own Git install. See <https://github.com/Microsoft/Git-Credential-Manager-for-Windows/blob/master/Docs/CredentialManager.md> and using the zip installer, extract the GCM files and then run  

\>git-credential-manager.exe deploy --path \<installation_path\>

<br />

<br />

<br />


author: XV
body: There was an issue as I had installed Git 2.18... as a regular user so it was installed in a local dir and while you provided information on working around that, did the following instead:

I removed everything (git, gcmw, sourcetree), removed prefetch files referencing the local location, cleaned up an LFS addition to my local path variable, and then reinstalled git 2.18..., GCMW, and LFS with Admin permissions. Setup Sourcetree and no more errors on pushes!

This will get me going now and I'll deal with setting this up as a regular user when I get ready to move to my customer's systems.

Thank you very much!


author: XV
body: Adding this from the Git options tab in case it's helpful:

![SourceTree Git Config.PNG](https://community.atlassian.com/t5/image/serverpage/image-id/31723iB2B73338A42ACDF5/image-size/large?v=v2&px=999 "SourceTree Git Config.PNG")


author: bgannin
body: Hi Kurt,

Thank you for noting this, it's a reasonable idea to avoid any LFS operations until we confirm the message is harmless. Please file a ticket (SRCTREE or SRCTREEWIN depending on your OS) and we'll take it from there.

Cheers,

Brian Ganninger  
Product Manager, Sourcetree


Tags: git

git-lfs