Sourcetree asks to download LFS adapter every startup
Asked by Blake Ewton:

Hi, my knowledge of source control is very basic. I started work at a new company that is using GIT LFS in its repository for a project. Every time I start Sourcetree it pops up a prompt titled

"Git LFS + bitbucket = More Speed!"

The dialog says:

"I see you're using Git LFS and Bitbucket! Sourcetree can speed up your uploads/downloads to Bitbucket by using a custom Git LFS adapter.Do you want to install this now? (recommended)"

I select yes, watch a fast download progress bar zoom by and disappear then go about my business. But every time I start Source tree I get this same prompt. I have no idea if the adapter is failing to install or if there is a disconnect and it doesn't realize its installed?

In addition I've had a weird error with Sourcetree today I think may be related to this issue. I was working on a feature branch. I committed and pushed my changes to the repo for my feature branch. I'm not finished with it yet or ready to merge back into the master, but I want to pull the latest master so I can get some files from it. When I pulled the latest master from the repo it gave a GIT lfs error and failed to download some of the files. Now its showing a whole huge list of new files I'm positive are from the master because several of them I've never seen before and are brand new, BUT its showing them as uncommitted changes on my machine. I've tried to discard them and that action fails as well. I'm basically stuck and I'm pretty sure its all related to this LFS issue. I would greatly appreciate help with this. I warn you my level of ability with command line, etc. is very limited so I would appreciate a slightly dumbed down response. :)

Thanks


Answers:
author: minnsey
body: Hi  

I'm going to assume you are running the windows version. The error you are seeing is actually to do with an add-on to the Git-LFS tool. It is a special adapter that is used to communicate with a special protocol with <https://bitbucket.org> and allow for quicker uploads/downloads. It is **not** required for using LFS.  

The git-lfs adapter executable should be installed into *%localappdata%\\Atlassian\\Sourcetree\\git_extras* as *git-lfs-bitbucket-media-api.exe*   

<br />

With Sourcetree open you can also check to see if Sourcetree is finding the version of Git, git-lfs and the adapter you expect. In the Tools/Options/Git tab. There it will tell you if you are using a system install of git, e.g. one in program files, or an embedded install, one Sourcetree brought with it and the versions of the various components.  

It would be useful to know if the adapter is installed? In theory Sourcetree will only prompt to install it if it cannot find it in the directory mentioned.  

With respect to the errors with the files from master. If you have committed + pushed your changes already I would be tempted to reset your local repository master to match the remote one   
see <https://stackoverflow.com/questions/1628088/reset-local-repository-branch-to-be-just-like-remote-repository-head>

comments: author: Blake Ewton
body: Michael I can't thank you enough for your help on this. This issue has been driving me nuts and I would love to get it resolved so I can get back to work on my project.

I looked in the directory you specified and git-lfs-bitbucket-media-api.exe is there

So I think it was originally running system Git and reading another thread trying to get help I switched it to embedded Git which it says is running version 2.14.1/LibGit2Sharp 0.24.0 + git-lfs v2.0.2

I had also tried selecting the *Update Embedded Git* button which I think I remember indeed downloading something. When I try to switch back to System Git now it asks for a path to the Git.exe

I've tried specifying this path and that did work:

%Local App Data%\\Atlassian\\SourceTree\\git_extras\\git-lfs.exe

When I specify that it just goes back to embedded git.

Thanks for the tip on the reset. I have been trying the pull and push multiple times and each time can sometimes get things reset and other times have issues. I have even cleared my local repo and recloned the remote repo which fixed it until I ran into another lfs pull error. Then after it errors the files it did pull are treated like uncommitted files and I have to try to reset them. This last time I had an issue where I was able to reset most of my files but some of them had purple question marks next to them. The description said there were no changes to the file and yet they were still being tracked as changes. I was unable to reset them or discard them so I had to commit them to get them to stop bugging me.


author: Blake Ewton
body: I should add I just tried installing the latest version of Git lfs from the Git website. It put it in the Program Files folder. I tried pointing to that exe when selecting to use the system version and it still jumped back to the embedded version. Thanks


author: minnsey
body: Sorry I may have confused you a little.  

When switching to a 'System' version you need to navigate to a folder containing 'git.exe' as this is all about referencing a copy of git you have installed yourself on your machine.  

Please try that.  

To keep things simple I wont address the other issues just yet (but they are not forgotten)


author: Blake Ewton
body: Thanks Michael for your response. I'm not sure what happened to it but I can't seem to locate my system GIT anymore. I've tried downloading it but the download keeps getting stuck from GIT's website. I'll continue to try and post here again when I get that downloaded and try running Sourcetree with system.


author: minnsey
body: If you use the standard installer it should go into  
c:\\program files\\Git  
Or  
c:\\program files (x86)\\git  

Depending on 64 vs 32 bit.


author: Blake Ewton
body: Hmm interesting I don't have Git in either location and neither does my coworker. I do have a Git LFS folder in program files. At one point I downloaded Git LFS from their website but I thought I uninstalled it.


author: minnsey
body: I think you need to persevere with trying to download and install Git from <https://git-scm.org> first.


author: Ale? Mohori?
body: Nevermind!

I installed a fresh copy of GIT and added it into PATH. Now everything is fine.


Tags: git-lfs