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
LFS fetches objects from wrong remote during pull #2105
Hi @derrickstolee, thanks for opening up this issue and sorry that you're having trouble. I have a few questions that I'd like to look at before diving in:
Push to "dev" in repo1.
Pull from "dev" in repo2.
With these commands, were these git push/pull commands or git lfs push/pull commands? Could you attach a log of all of these command runs using the GIT_TRACE=1 environment flag, and post the output here?
I tried my hand at reproducing this issue myself with the following test-case, but was unable to reproduce the problem:
@ttaylorr sorry that my repo steps weren't very clear. I don't fully understand your test infrastructure, so I hope you will accept the following repro steps as a Bash script (feel free to exchange the two remotes with your own copies):
#!/bin/bash
mkdir Issue2105-1
cd Issue2105-1
git init
git lfs track "*.txt"
echo blah > file.txt
git add file.txt .gitattributes
git commit -m "Initial commit"
git remote add origin https://stolee.visualstudio.com/DefaultCollection/LFS/_git/Issue2105A
git push -f origin master
cd ..
git clone https://stolee.visualstudio.com/DefaultCollection/LFS/_git/Issue2105A Issue2105-2
cd Issue2105-2
echo blerg > file2.txt
git add file2.txt
git commit -m "Second commit"
git remote add dev https://stolee.visualstudio.com/DefaultCollection/LFS/_git/Issue2105B
git push -f dev master
cd ../Issue2105-1
git remote add dev https://stolee.visualstudio.com/DefaultCollection/LFS/_git/Issue2105B
git pull dev master
I have the full logs available, but here is the important part from the git pull dev master command:
@derrickstolee are you using the git lfs smudge (or git lfs filter-process) command directly? These are known to not working by themselves with multiple remotes, since neither command takes a remote argument. You could use git lfs pull <remote> [branch] instead.
The problem is that Git has forgotten the last remote it's used by the time it invokes the smudge filter after running git pull. So LFS has to guess, and assumes the default. This is where a Git change would be welcome. Maybe after running git pull <remote>, Git could set GIT_REMOTE=<remote> in the env when calling the smudge filter...?
Activity
derrickstolee commentedon Mar 29, 2017
The situation gets exacerbated if I
git remote remove originas LFS chooses its URL as "/objects/batch":ttaylorr commentedon Mar 29, 2017
Hi @derrickstolee, thanks for opening up this issue and sorry that you're having trouble. I have a few questions that I'd like to look at before diving in:
With these commands, were these
git push/pullcommands orgit lfs push/pullcommands? Could you attach a log of all of these command runs using theGIT_TRACE=1environment flag, and post the output here?I tried my hand at reproducing this issue myself with the following test-case, but was unable to reproduce the problem:
derrickstolee commentedon Mar 30, 2017
@ttaylorr sorry that my repo steps weren't very clear. I don't fully understand your test infrastructure, so I hope you will accept the following repro steps as a Bash script (feel free to exchange the two remotes with your own copies):
I have the full logs available, but here is the important part from the
git pull dev mastercommand:Notice that the batch call goes to the
Issue2105Aremote and not theIssue2105Bremote.ttaylorr commentedon Mar 30, 2017
@derrickstolee interesting. I have a few ideas of what might be going on. Could you post the output of
git lfs envin the theIssue2105-1repo?derrickstolee commentedon Mar 31, 2017
Here is the result of
git lfs env:I know my Git version is weird. It should behave the same as 2.12.0 with regard to LFS.
ttaylorr commentedon Apr 4, 2017
I think this is an interaction with GVFS, or something else. None of these lines should be empty:
derrickstolee commentedon Apr 5, 2017
I repro'd this on a different computer that has never had a GVFS version of Git4W. Here is the
git lfs envoutput for that machine:I see that again those lines are empty in my environment, but I'm not sure how that applies to this issue.
ttaylorr commentedon Apr 5, 2017
@derrickstolee are you using the
git lfs smudge(orgit lfs filter-process) command directly? These are known to not working by themselves with multiple remotes, since neither command takes a remote argument. You could usegit lfs pull <remote> [branch]instead.derrickstolee commentedon Apr 5, 2017
I never did anything to set up the smudges directly. I just expect
git pull <remote> [branch]to work correctly.technoweenie commentedon Apr 5, 2017
The problem is that Git has forgotten the last remote it's used by the time it invokes the smudge filter after running
git pull. So LFS has to guess, and assumes the default. This is where a Git change would be welcome. Maybe after runninggit pull <remote>, Git could setGIT_REMOTE=<remote>in the env when calling the smudge filter...?