You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Document remote name requirements, show better errors #1053
Currently the smudge filters can only work with a remote named origin. Generally, by the time the smudge filters are called, the name of the remote pulled from cannot be determined, or there may never have been one (e.g. from checkout). We should add documentation to the smudge command indicating this requirement.
Right now, for example, when doing a git pull using a remote with a name other than origin, Git LFS will attempt to use an empty string as its endpoint, which results in a confusing error about unsupported protocols. We can detect this and fail earlier, with a better message.
The easiest workaround for this problem is to use the name origin for the remote. Alternatively, the smudge filter can be skipped and lfs operations run manually.
Reacted by Nathan Howell, Peter Gunold and Radon8472
We should probably just be calling & checking git.DefaultRemote() as in git lfs fetch which will pick up the tracking remote for the current branch. It's not free though, it will add a couple of extra git calls per smudge which is not ideal & reinforce the need for git lfs clone and potentially for more efficient wrappers for git pull/checkout in future.
#2710 explains why this would be the case. There's a fundamental lack of information for LFS to properly handle the data pull --- the server would need to be stored with the file pointer to pull the object from the right repo, but then there could only be one storage back end for the blobs.
I'd guess git would have to be patched to pass to smudge the current repo that is being handled?
I just ran into this issue while trying to merge a branch from a remote whose name is not origin. In fact, none of my remotes are named origin. I resolved it by creating a remote named origin that points to the same URL and merging from that.
Here is a log so you can see what I went through as an inexperienced user of Git LFS:
$ git fetch --all
...
$ git merge some_remote/master
git-lfs filter-process: 1: git-lfs filter-process: git-lfs: not found
fatal: The remote end hung up unexpectedly
$ sudo apt install git-lfs
...
$ git merge some_remote/master
error: The following untracked working tree files would be overwritten by merge:
.gitattributes
Please move or remove them before you merge.
Aborting
$ git status -s
D some_file_1
?? .gitattributes
$ git checkout .
Encountered 1 file(s) that should have been pointers, but weren't:
some_file_1
$ git status -s
M some_file_1
?? .gitattributes
$ git reset --hard
HEAD is now at 7654321 some_commit_title
Encountered 1 file(s) that should have been pointers, but weren't:
some_file_1
$ git status -s
M some_file_1
?? .gitattributes
$ rm .gitattributes some_file_1
$ git status -s
D some_file_1
$ git reset --hard
HEAD is now at 7654321 some_commit_title
$ git status -s
$ git merge some_remote/master
Downloading some_file_2 (6.4 MB)
Error downloading object: some_file_2 (0123456): Smudge error: Error downloading some_file_2 (0123456...): batch request: missing protocol: ""
Errors logged to some_log_file
Use `git lfs logs last` to view the log.
error: external filter 'git-lfs filter-process' failed
fatal: some_file_2: smudge filter lfs failed
I'd guess git would have to be patched to pass to smudge the current repo that is being handled?
Has this issue been raised with Git upstream? That seems to be the best way forward. Looking at the docs, a %r replacement for per-file smudging and a remote=<url> setting for the long-running protocol seems like it would be best. I feel like someone from the git-lfs team should start the thread though since I think that would be the most productive. @ttaylorr?
I've added this as a thing we'd like to add to Git on our upstream features board. It's a known thing I'm looking to implement, but I haven't gotten there yet. In general, upstream Git generally expects you to scratch your own itch, so having me ask for the feature without implementing it myself isn't likely to be productive.
In this case, merges are tricky, because the ref that's actually being checked out isn't the merge ref, and so we really need some way of reporting the origin ref for this data, which is more complex than just reporting the checked-out ref.
My just-conceived-and-not-at-all-thought-through plan is to provide a ref=refs/heads/master for the actual ref being checked out and origin-ref=refs/heads/master and origin-ref=refs/remotes/some_remote/master for the refs involved in the merge.
In general, upstream Git generally expects you to scratch your own itch, so having me ask for the feature without implementing it myself isn't likely to be productive.
It was more about asking if it was useful or other related work was ongoing rather than finding out if they'd do it.
It was more about asking if it was useful or other related work was ongoing rather than finding out if they'd do it.
I'm an upstream contributor and I follow the list reasonably closely, and I'm pretty sure there isn't ongoing work at the moment. I think other people may find this to be a useful feature; at least git annex may find it useful in addition to us.
I know the scope of this issue is for documenting the limitation, but being able to use git LFS with an arbitrarily named remote or multiple remotes would be useful.
I've added this as a thing we'd like to add to Git on our upstream features board. It's a known thing I'm looking to implement, but I haven't gotten there yet. In general, upstream Git generally expects you to scratch your own itch, so having me ask for the feature without implementing it myself isn't likely to be productive.
Can you link your request from git upstream here, so we can see what you requested and know a starting point to help?
Can you link your request from git upstream here, so we can see what you requested and know a starting point to help?
I haven't sent an explicit request for this upstream because upstream doesn't track feature requests outside of the list. If I sent a mail to the list asking for this, they'd tell me to implement it myself because they know full well that I'm capable of doing that. When you're a core contributor to Git, people don't write features for you. The issue, is however, tracked on https://github.com/git-lfs/git-lfs/projects/4.
Note that we have added support for the non-merge aspects of this in upstream Git via the ref attribute in the protocol stream (which you can see with GIT_TRACE=1 GIT_TRACE_PACKET=1, but it's not wired up in Git LFS yet. If someone wanted to add support for the origin-ref and origin-treeish (which is a commit if a commit is available, and a tree otherwise) for merges, then that would be great. We could then implement autodetection of remotes properly.
Right now I'm working on a different issue on upstream Git, which results in breakage with certain types of paths on Windows, so I'll get to this issue when I have additional time.
Activity
sinbad commentedon Mar 1, 2016
We should probably just be calling & checking
git.DefaultRemote()as ingit lfs fetchwhich will pick up the tracking remote for the current branch. It's not free though, it will add a couple of extra git calls per smudge which is not ideal & reinforce the need forgit lfs cloneand potentially for more efficient wrappers forgit pull/checkoutin future.apeyser commentedon Jun 20, 2018
This also happens if the default branch isn't origin, even if you're pulling from origin.
apeyser commentedon Jun 20, 2018
#2710 explains why this would be the case. There's a fundamental lack of information for LFS to properly handle the data pull --- the server would need to be stored with the file pointer to pull the object from the right repo, but then there could only be one storage back end for the blobs.
I'd guess git would have to be patched to pass to smudge the current repo that is being handled?
quinngrier commentedon Apr 22, 2019
I just ran into this issue while trying to merge a branch from a remote whose name is not
origin. In fact, none of my remotes are namedorigin. I resolved it by creating a remote namedoriginthat points to the same URL and merging from that.Here is a log so you can see what I went through as an inexperienced user of Git LFS:
mathstuf commentedon Apr 22, 2019
Has this issue been raised with Git upstream? That seems to be the best way forward. Looking at the docs, a
%rreplacement for per-file smudging and aremote=<url>setting for the long-running protocol seems like it would be best. I feel like someone from thegit-lfsteam should start the thread though since I think that would be the most productive. @ttaylorr?bk2204 commentedon Apr 23, 2019
I've added this as a thing we'd like to add to Git on our upstream features board. It's a known thing I'm looking to implement, but I haven't gotten there yet. In general, upstream Git generally expects you to scratch your own itch, so having me ask for the feature without implementing it myself isn't likely to be productive.
In this case, merges are tricky, because the ref that's actually being checked out isn't the merge ref, and so we really need some way of reporting the origin ref for this data, which is more complex than just reporting the checked-out ref.
My just-conceived-and-not-at-all-thought-through plan is to provide a
ref=refs/heads/masterfor the actual ref being checked out andorigin-ref=refs/heads/masterandorigin-ref=refs/remotes/some_remote/masterfor the refs involved in the merge.mathstuf commentedon Apr 24, 2019
It was more about asking if it was useful or other related work was ongoing rather than finding out if they'd do it.
bk2204 commentedon Apr 24, 2019
I'm an upstream contributor and I follow the list reasonably closely, and I'm pretty sure there isn't ongoing work at the moment. I think other people may find this to be a useful feature; at least
git annexmay find it useful in addition to us.jfindlay commentedon Jan 15, 2020
I know the scope of this issue is for documenting the limitation, but being able to use git LFS with an arbitrarily named remote or multiple remotes would be useful.
pizzard commentedon Sep 28, 2020
Can you link your request from git upstream here, so we can see what you requested and know a starting point to help?
bk2204 commentedon Sep 28, 2020
I haven't sent an explicit request for this upstream because upstream doesn't track feature requests outside of the list. If I sent a mail to the list asking for this, they'd tell me to implement it myself because they know full well that I'm capable of doing that. When you're a core contributor to Git, people don't write features for you. The issue, is however, tracked on https://github.com/git-lfs/git-lfs/projects/4.
Note that we have added support for the non-merge aspects of this in upstream Git via the
refattribute in the protocol stream (which you can see withGIT_TRACE=1 GIT_TRACE_PACKET=1, but it's not wired up in Git LFS yet. If someone wanted to add support for theorigin-refandorigin-treeish(which is a commit if a commit is available, and a tree otherwise) for merges, then that would be great. We could then implement autodetection of remotes properly.Right now I'm working on a different issue on upstream Git, which results in breakage with certain types of paths on Windows, so I'll get to this issue when I have additional time.