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
git clone file://somelocal-lfs-repo does not work... #724
create a new repository locally, without any remote.
lfs track some files.
add some files
git commit
got to a different location..
git clone file://localrepo name2
Errors logged to .git\lfs\objects\logs\20151008T171907.6430782.log
Use git lfs logs last to view the log.
Downloading packages/blz/2.4.1-sc2/noarch/src/math.cpp (1.42 KB)
Error accessing media: packages/blz/2.4.1-sc2/noarch/src/math.cpp (ca8d92a9a6c9595749e0120116020ea2c4c3a8fb7b58e3f01abf9
459b4553c00)
neither repo has a remote at this point, and purely exists locally...
Git LFS requires a web server to talk to. It gets the web server address by converting an HTTPS or SSH remote, but doesn't know what to do with a file remote. You can set one explicitly:
# set it for a specific remote in the repo
$ git config remote.{remote-name}.lfsurl https://some-git-lfs-server.com
# sets it for all remotes in the repo
$ git config lfs.url https://some-git-lfs-server.com
I see, but would that server not have the content either? since I never pushed anything?
I guess what I was hoping for is that in a local clone, it would just refer to the local lfs/objects folder.
That's the lfs env from the repository clone that didn't work? That shows an SSH remote.
You have several options that could work:
If you're going to be cloning from local paths a lot, you can commit the lfs.url config setting to .gitconfig in your repo. But, this means that everyone will have the same url there. So this may not be your best solution. You can do that like this: git config --file .gitconfig lfs.url booya. This is not a standard config file location that Git reads, but Git LFS will read it. You can verify with git lfs env.
You can also disable automatic downloading. Perhaps have a script that clones a repo, sets up the lfs url, and pulls?
A third option is to try out the new git worktree feature. This requires Git 2.5+. I haven't worked with it too much, but it lets you setup multiple working directories from a single local clone. Git LFS automatically supports this by looking for files in the .git/lfs/objects dir of the worktree's bare git repo.
Can you show me git lfs env from the lfs-test5 repo? I've confirmed that disabling batch should work:
# already disabled
$ git lfs env | grep Batch
BatchTransfer=false
# clear objects to force it to download again
$ rm -rf .git/lfs/objects
$ GIT_TRACE=1 git lfs pull | grep "lfs/objects"
trace git-lfs: HTTP: GET https://github.com/github/git-lfs-test.git/info/lfs/objects/b9f86fab477109565871ced361ba69f2425a91fbe6057fa7a9629a8d536d7c71
trace git-lfs: HTTP: GET https://github-cloud.s3.amazonaws.com/alambic/media/111976139/b9/f8/b9f86fab477109565871ced361ba69f2425a91fbe6057fa7a9629a8d536d7c71?actor_id=21
trace git-lfs: HTTP: GET https://github.com/github/git-lfs-test.git/info/lfs/objects/55d51edb307ed7bf4a1bbca3867d132a07f76828d57f37e0f31f712c02ceafe0
trace git-lfs: HTTP: GET https://github.com/github/git-lfs-test.git/info/lfs/objects/d1c8fab51418ef587fcf5dd8e73c60b9700704e2f8f5292ea12ec27c285b23a3
trace git-lfs: HTTP: GET https://github-cloud.s3.amazonaws.com/alambic/media/111976139/55/d5/55d51edb307ed7bf4a1bbca3867d132a07f76828d57f37e0f31f712c02ceafe0?actor_id=21
trace git-lfs: HTTP: GET https://github-cloud.s3.amazonaws.com/alambic/media/111976139/d1/c8/d1c8fab51418ef587fcf5dd8e73c60b9700704e2f8f5292ea12ec27c285b23a3?actor_id=21
Notice that the client is hitting lfs/objects/{oid} once for each object, and also making an S3 request for each object. This is what it looks like when I turn batch transfers back on:
$ git config --unset lfs.batch
$ git lfs env | grep Batch
BatchTransfer=true
# clear objects to force it to download again
$ rm -rf .git/lfs/objects
$ GIT_TRACE=1 git lfs pull | grep "lfs/objects"
trace git-lfs: HTTP: POST https://github.com/github/git-lfs-test.git/info/lfs/objects/batch
trace git-lfs: HTTP: 200
trace git-lfs: HTTP: GET https://github-cloud.s3.amazonaws.com/alambic/media/111976139/b9/f8/b9f86fab477109565871ced361ba69f2425a91fbe6057fa7a9629a8d536d7c71?actor_id=21
trace git-lfs: HTTP: GET https://github-cloud.s3.amazonaws.com/alambic/media/111976139/55/d5/55d51edb307ed7bf4a1bbca3867d132a07f76828d57f37e0f31f712c02ceafe0?actor_id=21
trace git-lfs: HTTP: GET https://github-cloud.s3.amazonaws.com/alambic/media/111976139/d1/c8/d1c8fab51418ef587fcf5dd8e73c60b9700704e2f8f5292ea12ec27c285b23a3?actor_id=21
Now it's making one API call to "info/lfs/objects/batch", and then one to download each specific file from S3. Of course, yours won't be getting them from S3. But the ratio of requests should be the same. 1 batch request for every 100 files, and then one request to download each individual file (as opposed to a 1 to 1 mapping of LFS requests and download requests as shown above).
Okay. Try turning off the lfs.url config setting. You only should've needed that when the remote was a file:// url. One of your earlier env output should work:
removing that from the gitconfig for that repo makes the endpoint go back to file://
basically the cloned repository does not have a remote setup, so just configuring the endpoint will not setup the SSH= part, and hence does not setup the authentication part.. The conclusion really is that, even though you can make a local clone by disabling a whole bunch of stuff, once the local clone is there, you have to completely replicate all remotes and endpoints to make git lfs work... I might as well have just pulled from the remote directly...
The only functional way I see right now to use "copies" would be to use the worktree feature..
which is OK btw... but my opinion still is that
git clone file://somerepo
should just work.... and whether that needs for you to implement the "file" protocol, or for LFS to correctly copy the settings to connect to the right remote based on the source repository, I leave up to you...
Oh, I thought you were in a worktree. That seems to be the preferable option for having multiple clones of a repository locally. Seems to make sense in cases where you might want multiple branches checked out at the same time. Worktrees would ensure that you have a single .git with one copy of your git and your lfs objects.
I definitely agree that file:// support would be nice too.
Activity
technoweenie commentedon Oct 9, 2015
Git LFS requires a web server to talk to. It gets the web server address by converting an HTTPS or SSH remote, but doesn't know what to do with a file remote. You can set one explicitly:
tvandijck commentedon Oct 9, 2015
I see, but would that server not have the content either? since I never pushed anything?
I guess what I was hoping for is that in a local clone, it would just refer to the local lfs/objects folder.
tvandijck commentedon Oct 9, 2015
Yeah, as expected... I added a remote, never pushed a thing... same error...
technoweenie commentedon Oct 9, 2015
What does
git lfs envshow?tvandijck commentedon Oct 9, 2015
and actually, I just pushed the entire repo to the server, and tried it again:
same errors.... so even with the remote setup in the source repository, and all files uploaded to the server, a local clone does not function.
technoweenie commentedon Oct 9, 2015
That's the
lfs envfrom the repository clone that didn't work? That shows an SSH remote.You have several options that could work:
If you're going to be cloning from local paths a lot, you can commit the
lfs.urlconfig setting to.gitconfigin your repo. But, this means that everyone will have the same url there. So this may not be your best solution. You can do that like this:git config --file .gitconfig lfs.url booya. This is not a standard config file location that Git reads, but Git LFS will read it. You can verify withgit lfs env.You can also disable automatic downloading. Perhaps have a script that clones a repo, sets up the lfs url, and pulls?
$ GIT_LFS_SKIP_SMUDGE=1 git clone file:///d/test/lfs-test lfs-test5 $ cd lfs-test5 $ git config remote.origin.lfsurl https://ghosthub.corp.blizzard.net/tdijck/lfs-test.git/info/lfs $ git lfs pullAt this point, everything should be setup.
A third option is to try out the new git worktree feature. This requires Git 2.5+. I haven't worked with it too much, but it lets you setup multiple working directories from a single local clone. Git LFS automatically supports this by looking for files in the
.git/lfs/objectsdir of the worktree's bare git repo.tvandijck commentedon Oct 9, 2015
the worktree feature obviously works...
technoweenie commentedon Oct 9, 2015
Try disabling the batch API. The client doesn't seem to be detecting that the batch API isn't implemented on your instance. That sucks :(
$ git config lfs.batch falseYou can confirm this by looking for "BatchTransfer=false" in
git lfs env.tvandijck commentedon Oct 9, 2015
We turned off the batch API globally in git, so that was already the case.
technoweenie commentedon Oct 9, 2015
Can you show me
git lfs envfrom the lfs-test5 repo? I've confirmed that disabling batch should work:Notice that the client is hitting
lfs/objects/{oid}once for each object, and also making an S3 request for each object. This is what it looks like when I turn batch transfers back on:Now it's making one API call to "info/lfs/objects/batch", and then one to download each specific file from S3. Of course, yours won't be getting them from S3. But the ratio of requests should be the same. 1 batch request for every 100 files, and then one request to download each individual file (as opposed to a 1 to 1 mapping of LFS requests and download requests as shown above).
tvandijck commentedon Oct 9, 2015
ok, so you are right, it was actually true for that repo... so after fixing that I get:
doesn't look like it's pulling any files...
tvandijck commentedon Oct 9, 2015
running it with GIT_TRACE=1 I get
technoweenie commentedon Oct 9, 2015
A 403 means you're not authenticating properly. Do you have an http credential cacher setup?
https://help.github.com/articles/caching-your-github-password-in-git/#platform-windows
Microsoft just released a new one: https://github.com/Microsoft/Git-Credential-Manager-for-Windows. No clue how that works.
Or, are you purely using SSH for git authentication?
tvandijck commentedon Oct 9, 2015
purely using SSH.
technoweenie commentedon Oct 9, 2015
Okay. Try turning off the
lfs.urlconfig setting. You only should've needed that when the remote was afile://url. One of your earlierenvoutput should work:With that setup, Git LFS will get a temporary token from SSH before hitting the LFS API.
tvandijck commentedon Oct 9, 2015
removing that from the gitconfig for that repo makes the endpoint go back to file://
basically the cloned repository does not have a remote setup, so just configuring the endpoint will not setup the SSH= part, and hence does not setup the authentication part.. The conclusion really is that, even though you can make a local clone by disabling a whole bunch of stuff, once the local clone is there, you have to completely replicate all remotes and endpoints to make git lfs work... I might as well have just pulled from the remote directly...
The only functional way I see right now to use "copies" would be to use the worktree feature..
which is OK btw... but my opinion still is that
should just work.... and whether that needs for you to implement the "file" protocol, or for LFS to correctly copy the settings to connect to the right remote based on the source repository, I leave up to you...
technoweenie commentedon Oct 9, 2015
Oh, I thought you were in a worktree. That seems to be the preferable option for having multiple clones of a repository locally. Seems to make sense in cases where you might want multiple branches checked out at the same time. Worktrees would ensure that you have a single
.gitwith one copy of your git and your lfs objects.I definitely agree that
file://support would be nice too.