Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

How to get LFS working with SourceTree on Windows (or at all)

blackishmarkus February 23, 2016

We have a big project that hit the 2GB limit on BitBucket, so we really need to switch to LFS. I set everything up in the new version of SourceTree on Windows (Git LFS > Initialize Repository, added all filetypes and one specific filepath), but it just wouldn't get done adding and pushing all those files. I blamed the new SourceTree GUI and switched to the terminal and managed to get the rest of the project committed and pushed. Now the repository should be under 500 MB and the LFS part should be around 1.6GB. All good. Except that no one in our team is able to clone the project.

If I try to clone in SourceTree on Windows I get this response: 

Error downloading object: [...].png ([id])
error: external filter git-lfs smudge %f failed 2
error: external filter git-lfs smudge %f failed
fatal: [path to png]: smudge filter lfs failed

If I try to clone via the terminal ( git clone https://bitbucket.org/myteam/myproject ):

I get to put in my username and password and it downloads all the non-lfs elements, then tries to download the first png from LFS and hangs there forever.

If I navigate to one of the PNG files in LFS on the Bitbucket website, I only see a broken image icon, if I click on edit I see the long id, if I click on RAW I go to an empty little box on bytebucket.com 

If I try to clone in SourceTree on the Mac, it clones the non-LFS stuff, then tries to lfs pull and says:

Post https://bitbucket.org/account/signin/?next=/account/signin/%3Fnext%3D/account/signin/%253Fnext%253D/morildinteraktiv/rr-ferry.git/info/lfs/objects/batch:
stopped after 3 redirects

Git LFS: (0 of 1391 files) 0 B / 1.60 GB               
Completed successfully

I'm left with PNG files that only containing the ids, not the images.

How can I get LFS to work?

2 answers

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

4 votes
stevestreeting
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 23, 2016

There's also a known PATH bug in SourceTree for Windows 1.8.2 which causes the "error: external filter git-lfs smudge %f failed 2" when using the System Git (assuming git-lfs is installed and on your path).

You can fix this by switching to the embedded git in Tools > Options > Git, which will use an internal version of git-lfs too. The PATH problem for using external, system-installed versions will be fixed next week. 

Linden deCarmo April 25, 2016

I'm running 1.8.3 on Win10 64-bit using the embedded git and still seeing

 

filter git-lfs smudge %f failed

is there any work around for this release?  If I use the terminal, I can clone without an error, its only the SourceTree GUI that isn't working.

stevestreeting
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 25, 2016

Usually when you open an LFS repo and SourceTree can't see the 'git lfs' command, it will prompt you to download the embedded git-lfs. I just tried this with 1.8.3 and it did that for me & installed the LFS 1.8.3 knows about.

But, since you're using git & lfs on the command line, you might want to get SourceTree to use those versions for consistency, that way you know you're using the same versions in both places. Did you install git-lfs with the Windows installer? If so, it should have been added to your PATH (if it's a recent version), which means SourceTree should be able to see it - however you will have needed to have restarted SourceTree since that was the case. Please try doing that first. 

If that doesn't work, please double-check that your PATH environment variable in Control Panel > System > Advanced System Settings > Environment Variables includes the folder that git-lfs.exe is in. It's important that you look there and not just in the Git Bash shell since that might derive it from a non-Windows .bash_profile or something. If you have to add the git-lfs.exe folder to PATH in environment variables, restart SourceTree after doing so.

HTH

Linden deCarmo April 26, 2016

Hi Steve,

Let me provide a little more background to my problem.  Prior to trying this, I did install the git-lfs binary.  In addition, I only tried the command line after SourceTree failed (and the command line was the embedded terminal).  I wanted to see if it would work (and it did).  I'm running with the embedded version of git and not a system wide installation (I don't have git installed outside of SourceTree).  I have restarted SourceTree multiple times since git-lfs was installed.  Source tree reports that its using git-lfs v 1.2.0

 

My PATH variable does include the path to git-lfs and this shows at the windows command prompt (not just bash) and also in the control panel.

stevestreeting
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 26, 2016

Hmm, this may be related to another problem I saw with the 1.9 beta which has been fixed since; I thought it was contained to only the 1.9 stream but it sounds very similar to what you're seeing. The issue was related to specifically Git as launched by SourceTree not being able to see git-lfs on the path, but SourceTree itself being able to call it direct so it thinking there isn't an issue. 

There are 3 alternative ways that can resolve this, either:

  1. Join the beta program to get early access to 1.9: https://blog.sourcetreeapp.com/2016/03/25/sourcetree-beta-program-is-here-become-a-trusted-tester/, or 
  2. Uninstall your system copy of git-lfs.exe (and remove from your path) and make sure it's not visible anywhere on your system. This is slightly complicated by the fact that in older versions of git-lfs it installed itself inside your system git install, so it's actually best to do a search to be sure. Then, re-open any repository that uses git-lfs and you should be prompted to download the embedded version of git-lfs to match your embedded version of Git, or
  3. Change SourceTree to use the System Git in Tools > Options > Git, if your command line version can see it then telling ST to use it should resolve it.

I believe it's the mixture of embedded git and system git-lfs that's confusing SourceTree 1.8 and that one of the above should resolve that.

Linden deCarmo April 26, 2016

I don't believe #3 is an option.  I only have the embedded git on my system and mingw only sees git and git-lfs when launched from SourceTree.  Based on what you're saying, SourceTree really should be able to see the git-lfs if the embedded variant of mingw can see it right?

stevestreeting
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 26, 2016

In theory yes, but in practice it's not quite that simple because when you open the terminal you're running a full shell which parses other config files which can modify the path, wheras SourceTree calls git directly. #2 is the best option if you're only ever intending to use the embedded git.

Linden deCarmo April 27, 2016

@Steve Streeting

Tried alternative #2.

I completely uninstalled git-lfs and removed all traces of it from my system.  SourceTree prompted me to download the embedded git-lfs and the Source Tree options report git-lfs v1.1.1 as being used. mingw reports 1.1.1 (embedded version now).

 

Unfortunately, sourcetree fails the same way with embedded git-lfs v1.1.1 just like external git-lfs v2.0.  mingw command line works without error.

 

I installed system-wide git and git-lfs.  SourceTree still fails the same way.

 

Sorry for the delay in responding but the system limited me to two comments in 24 hours.

stevestreeting
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 27, 2016

Hrm, really sorry this is turning out to be such a hassle - as I mentioned there was a problem similar to this in the 1.9 beta stream (fixed in the latest) but I can't seem to reproduce it on 1.8.3 here.


At this stage that leaves option #1 the 1.9 beta - I can talk to the team to make sure you get quick to the 1.9 beta if you're interested in trying that, or option #3 which will require you to install a system git from http://git-scm.com as well as the latest system git-lfs and pointing SourceTree at that.

Again, apologies for this; embedded LFS was working fine earlier in 1.8 but something went awry it seems. This will be resolved (is resolved AFAICT in the beta) soon. I'm not sure what the commenting limit is about, if you need to contact me on email instead I'm sstreeting at Atlassian dot com.

Linden deCarmo April 27, 2016

I think you may have missed my last comment that I had tried #3 (using both git 1.9.5 and 2.8.1) with git-lfs 1.2 and both failed from source tree (work ok from the command line). 

I think the only option left is #1 at this point.  I was approved for the google group yesterday, I'll look into trying the beta now.

Regarding the comment issue, the site blocks me from adding more than two comments in 24 hours until I have at least three points of reputation.  Likely this is the last comment I can do today so I'll have to follow up via email.

stevestreeting
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 27, 2016

Ah yes, sorry for missing that. Let's see how you get on with the beta and we can follow up 1:1 if you still can't get it working.

stevestreeting
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 28, 2016

For future reference this was a bug with OpenSSH handling, details at: https://jira.atlassian.com/browse/SRCTREEWIN-5591

1 vote
Ben Humphreys
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
February 23, 2016

Bitbucket Cloud (i.e. bitbucket.org) does not yet support Git LFS. The feature is currently being implemented and there is an open feature request you can keep an eye on https://bitbucket.org/site/master/issues/11204/support-git-lfs-extension-bb-12743

The self hosted Bitbucket Server product (previously known as Stash) does support Git LFS as of version 4.3: https://confluence.atlassian.com/pages/viewpage.action?pageId=794364846

Regards,
Ben

TAGS
AUG Leaders

Atlassian Community Events