Lasse V. Karlsen
Lasse V. Karlsen

Reputation: 391596

Disable git LFS Locking api locally because it is super-slow?

I tend to try to answer a lot of git questions here on Stack Overflow, but in doing so, I like to first set up a dummy repository or two locally and test out what I'm proposing before posting.

Recently I got a new computer, and I guess something is either different with my configuration now, or it's been a while since I used git locally for this kind of thing because there has been introduced a big delay when pushing locally.

Let me give an example:

git init --bare remote
git clone remote local
cd local
echo abc >test.txt
git add .
git commit -m "abc"
git push

This last command has a delay of about 12 seconds before it outputs this:

λ git push
Remote "origin" does not support the LFS locking API. Consider disabling it with:
  $ git config lfs.https://z////Temp/remote.git/info/lfs.locksverify false
Enumerating objects: 5, done.
Counting objects: 100% (5/5), done.
Writing objects: 100% (3/3), 254 bytes | 254.00 KiB/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To Z:/Temp/remote
   2c2a0cf..12a484c  master -> master

The question is, can I disable this LFS locking api probing or what it is doing here when using these commands locally, without having to add --no-verify on all such pushes? Basically, I would like to use git as normally without having to remember that git lfs probing seems to be broken locally.

I do not want to disable this LFS functionality for all git interactions with remotes, as I have at least one repository on github where I use it. "It" being LFS, is this LFS locking perhaps not needed and I can turn it off globally?

Or is this perhaps some kind of bug, and I should really be reporting this as such?

This is Git 2.24.1.windows.2, Windows 10 build 1909, running on a AMD Ryzen 5 3600 against a M.2 2GB/sec SSD, so I assume "slow computer or disk" is not really the problem either.

The only provided ways I've found is that I either specify --no-verify on all such pushes, or that I explicitly provide a per-repository configuration that disables it, like what git push is suggesting above. I really don't like either solution, are there any other?

If I issue this push command:

git push --no-verify

it completes in a fraction of a second. Basically my question is if there is a way to configure git so that all local pushes have this speed, without having to either explicitly configure the repository/ies or having to specify this --no-verify every time.

Upvotes: 4

Views: 2314

Answers (1)

Paul
Paul

Reputation: 1

tldr; Try git config --global lfs.locksverify false.


From their doc: https://github.com/git-lfs/git-lfs/blob/main/docs/man/git-lfs-config.adoc#other-setting :

Meaning in your global git config file, you can do something like this to be specific to a domain:

[lfs "https://example.com/"]
    locksverify = false

Turns out the following also works and will apply to any repository:

[lfs]
    locksverify = false

You can then override the value for a particular repository.

Upvotes: 0

Related Questions