Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Large File Storage #14

Open
zharinov opened this issue Nov 14, 2020 · 10 comments
Open

Large File Storage #14

zharinov opened this issue Nov 14, 2020 · 10 comments

Comments

@zharinov
Copy link

@zharinov zharinov commented Nov 14, 2020

@denolehov, thank you for this plugin!

I tried to use git-lfs feature for my images sub-folder and here is error in my console:

This repository is configured for Git LFS but 'git-lfs' was not found on your path.
If you no longer wish to use Git LFS, remove this hook by deleting .git/hooks/pre-push.

Basically, hook content looks like this:

#!/bin/sh
command -v git-lfs && git lfs pre-push "$@"

I wonder if this can be fixed just by passing parent PATH via this option.

More context:
Obsidian: 0.9.14
OS: macOS Big Sur

To reproduce, I guess it would be enough to follow this setup.
Also, maybe I'll be able to figure out obsidian plugin development setup and debug it on my own.

UPD. As I can see, obsidian process doesn't contain /usr/local/bin directory in its PATH, i.e. it uses system-wide git command instead of homebrew-installed one.

@denolehov
Copy link
Owner

@denolehov denolehov commented Nov 22, 2020

Hey, I will look into this closer to next weekend. Sorry for the late reply.

@danmichaelo
Copy link

@danmichaelo danmichaelo commented Nov 29, 2020

Similar issue to #21, but in the case of git-lfs, I don't think there is a git-config option to set the path to git-lfs. So perhaps the best would be to introduce two new plugin settings: "Path to git" and "Path to git-lfs", that can be used to override the system defaults? Never mind, you can tell simpleGit to use a specific git binary, but it will still use the git-lfs binary on PATH, so I'm not really sure what would be a good way to make this configurable. Modifying the PATH variable would of course work, but it seems a bit outside the scope of this plugin to do.

@sascha-wolf
Copy link

@sascha-wolf sascha-wolf commented Apr 20, 2021

I've encountered the same issue.

My solution was to manually update the .git/hooks installed by git-lfs (post-commit, post-checkout, post-merge, and pre-push) and add the following line at the top of each one:

PATH="$PATH:/usr/local/bin"

(This assumes that the git-lfs binary resides in /usr/local/bin, which is the case if you installed it through brew by example.)

This will update the PATH variable for the scope of the script and not impact your "usual" PATH, and as such can be considered safe.

@frankreporting
Copy link

@frankreporting frankreporting commented Jun 12, 2021

Tried the above recommendation but still got errors.

Cannot add files: git-lfs
filter-process: git-lfs: command not found
fatal: the remote end hung up unexpectedly

I checked git-lfs location with which and it was usr/local/bin, added that path line in the top of each hook.. though was I supposed to update them some other way first, or is that what sascha-wolf meant by manually updating? Any other ideas what could be causing it to fail?

@cor
Copy link

@cor cor commented Sep 1, 2021

This is still an issue as of 2021-09-01

@mracette
Copy link

@mracette mracette commented Dec 9, 2021

I had the same issue as @frankreporting when I installed git-lfs using homebrew (location was /opt/homebrew/bin).

To resolve it, I installed the package at https://git-lfs.github.com/ and ran install.sh, which installed git-lfs to /usr/local/bin (you may also be able to just move the binary).

After that, I was able to add PATH=$PATH:/usr/local/bin to the git hooks and after restarting Obsidian everything worked.

@bevsxyz
Copy link

@bevsxyz bevsxyz commented Dec 14, 2021

I've encountered the same issue.

My solution was to manually update the .git/hooks installed by git-lfs (post-commit, post-checkout, post-merge, and pre-push) and add the following line at the top of each one:

PATH="$PATH:/usr/local/bin"

(This assumes that the git-lfs binary resides in /usr/local/bin, which is the case if you installed it through brew by example.)

This will update the PATH variable for the scope of the script and not impact your "usual" PATH, and as such can be considered safe.

@sascha-wolf Why should I do that? My git-lfs binary is already in the path.

@sascha-wolf
Copy link

@sascha-wolf sascha-wolf commented Jan 18, 2022

@sascha-wolf Why should I do that? My git-lfs binary is already in the path.

If it works for you, you don't. It didn't for me, git-lfs wasn't in the PATH of the script execution.

@christyray
Copy link

@christyray christyray commented Jan 20, 2022

Like @frankreporting and @mracette, I was having the same issue where it still wasn't working even after I added PATH="$PATH:/usr/local/bin" to the top of each git hook.

I didn't want to download and install git-lfs manually since I wanted to maintain the management by Homebrew. I was specifically getting an error message about filter-process, and I realized that was part of the filters Git LFS defines in the .gitconfig.

I updated my global .gitconfig to refer to /usr/bin/local/git-lfs instead of just git-lfs on all of the filter lines. That combined with adding PATH="$PATH:/usr/local/bin" to the top of each git hook fixed it for me!

That section of my global .gitconfig now looks like:

[filter "lfs"]
	process = /usr/local/bin/git-lfs filter-process
	required = true
	clean = /usr/local/bin/git-lfs clean -- %f
	smudge = /usr/local/bin/git-lfs smudge -- %f

@finn-matti
Copy link

@finn-matti finn-matti commented Feb 27, 2022

Thanks @christyray, your tip solved it for me!

You can put that section also inside the .git/config file of the Obsidian repo itself, if you don't want to change your global .gitconfig file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
10 participants