Multiple remote with git lfs

I work on renkulab, but a collaborator works in a different remote. I can add the different remote without problems. However git LFS is not behaving the same way.
In particular, when I try to checkout a git LFS file from this other remote, it tries to download, then give a [404] error.

attempt for checking out the git LFS file

git checkout remote_origin/branch_on_remote -- OBJECT 

OBJECT corresponds to the path of the file from root of the repo, remote_origin is the remote where I’m trying to fetch the git LFS file from.

Error message:

Downloading OBJECT (273 B)
Error downloading object: OBJECT (c902841): Smudge error: Error downloading OBJECT (c902841c5cf3623d8f79985e16412fe436d4ff3a55b0094cfa02947xxxxxxxxx): [c902841c5cf3623d8f79985e16412fe436d4ff3a55b0094cfa02947xxxxxxxxx] Object does not exist on the server or you don’t have permissions to access it: [404] Object does not exist on the server or you don’t have permissions to access it

Errors logged to project/.git/lfs/logs/20210601T112524.125834236.log
Use git lfs logs last to view the log.
error: external filter git-lfs smudge – %f failed 2
error: external filter git-lfs smudge – %f failed
fatal: OBJECT: smudge filter lfs failed

I read that git LFS cannot handle multiple remotes, is that really the case? Do I need to download the file and manually add it?

Thanks!
Firat

Edit: If I use a regular git file for OBJECT instead of a git LFS object, it works.

Hi @firat - can you include the actual commands you used?

Hi @rrrrrok, I just edited my question to include it, thanks!

are you sure the LFS objects have been pushed to this other remote? i.e. if you clone that repo by itself, it works?

Yes, I can confirm it is in the repo and I can pull it if I clone that repo

I think using git LFS with multiple remotes isn’t properly supported by LFS, see

and

the last of which contains a workaround.

Hi @ralf.grubenmann,

When I first came across the last issue you referenced, I thought that cannot be it, because it didn’t seem to do anything at first. I tried again on a clean clone of the other repo, trying to git lfs pull from renkulab this time.
1st attempt, same error (for a different git LFS object, obviously). Git checked out git files, but lfs failed, so I was still on the old branch from other remote with all the different files.

git stash save

and one more attempt, then it worked! I don’t know why git LFS tried to download objects the first time I checked out a branch from renkulab even though I disabled it

git lfs install --skip-smudge --local

Regardless, it now seems to work, thanks!


For future reference, exact steps are the following. For the setting where I am on remoteA and I want to fetch git LFS from branch branchB from remoteB:

git lfs install --skip-smudge --local
git checkout -b branchBfromremoteB remoteB/branchB
git lfs pull remoteB

If second step fails, git stash save, and repeat again… :slight_smile:

Firat

2 Likes