SourceTree: Git extensions (like LFS) and System Git
Asked by Stefan Baumgartner:

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.


Answers:
author: Stefan Baumgartner
body: 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

comments: author: David Bernard
body: 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).


author: Georg Schmidt
body: :-) 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.


author: David Bernard
body: Yeah I found out after I commented. So I created an issue about that: <https://jira.atlassian.com/browse/SRCTREE-3174>


author: Shawn Halwes
body: 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.


author: David Bernard
body: 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.

comments: author: Joseph Humfrey
body: Thanks, this one worked for me!


author: Stefan Baumgartner
body: 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'](http://git-lfs-endpoint&#39);;;: somethingPassword 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 -\> masterOne thing that popped into my mind is that I'm using zsh. Might that be a problem? Best, Stefan


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