SourceTree: Git extensions (like LFS) and System Git

Hello everyone!

I'm kinda lost here so I hope you can help me. We use the new Git LFS from GitHub on our servers, and want our designers to use it via the SourceTree app. The Git LFS extension is pretty need because you just need to activate it once, and then you can use your standard git commands (like add/push/commit) without any special extras, LFS just knows to put it somewhere else.

Now I thought that with SourceTree (and the switch to use System Git) this might be possible, too, since SourceTree would just act as some sort of wrapper to the original commands. Sadly, it doesn't work: 

git -c diff.mnemonicprefix=false -c core.quotepath=false -c credential.helper=sourcetree add -f -- "Screen Shot 2015-06-01 at 15.29.57.png" 
git: 'lfs' is not a git command. See 'git --help'.
 
Did you mean this?
 flow
error: copy-fd: write returned Broken pipe
error: cannot feed the input to external filter git lfs clean %f
error: external filter git lfs clean %f failed 1
error: external filter git lfs clean %f failed
fatal: Screen Shot 2015-06-01 at 15.29.57.png: clean filter 'lfs' failed
Completed with errors, see above

 

Do I miss something? Should I run it as a different user maybe? If so, how can I do it.

4 answers

1 accepted

Okay, I found the problem. I am using System Git, yes, but I don't have access to everything in PATH. SourceTree looks for the extensions in the same folder where Git is, so I just have to link to the git-lfs extension, so it seems to be in the same folder as System Git.

 

    ln -s /usr/local/bin/git-lfs /usr/bin/git-lfs

But this symlink is only a workaround, because everyone will need to re-create it every time they install a new Mac OS X version (like El Capitan :P).

:-) in some way you are right... but I just found out that it seem to be not possible to create a symlink like "ln -s /usr/local/bin/git-lfs /usr/bin/git-lfs" in "El Capitan". There seem to be restrictions even to root. Thanks. Your post somehow helped.

Yeah I found out after I commented. So I created an issue about that: https://jira.atlassian.com/browse/SRCTREE-3174

In Windows I just copied the git-lfs.exe file to the bin directory that the GitHub system git.exe is in and the errors generated by SourceTree go away.

On OS X 10.11 (El Capitan), the /usr/bin folder is now restricted, so the workaround now is to have everything inside /usr/local/bin, and symlink the "git" binary (not git-lfs) there:

ln -s /usr/bin/git /usr/local/bin/git

And then in SourceTree choose the Use System Git from /usr/local/bin.

Thanks, this one worked for me!

What happens if you run those git commands from the command line by hand? Are you on Mac or Windows?

Hey Seth, thanks for looking into it. We are on Mac, all of us. When I run it via the command line it works like a charm, that's the output: ➜ marketing-lfs git:(master) git push origin master (0 of 1 files) 0 B / 386.41 KB 0.00 % Username for 'http://git-lfs-endpoint';;;: something Password for 'http://git-lfs-endpoint;: (1 of 1 files) 386.41 KB / 386.41 KB 100.00 % 4s Counting objects: 3, done. Delta compression using up to 4 threads. Compressing objects: 100% (3/3), done. Writing objects: 100% (3/3), 385 bytes | 0 bytes/s, done. Total 3 (delta 1), reused 0 (delta 0) To https://git-endpoint e74defe..25d7f77 master -> master One thing that popped into my mind is that I'm using zsh. Might that be a problem? Best, Stefan

Suggest an answer

Log in or Join to answer
Community showcase
Brian Ganninger
Published Jan 23, 2018 in Sourcetree

Tip from the team: workflow and keyboard shortcuts

Supported Platforms macOS Sourcetree has a lot to offer and, like many developer tools, finding and using it all can be a challenge, especially for a new user. Everyone might not love ...

248 views 0 3
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot