gpt4 book ai didi

git - 如果我没有 git lfs lock 会发生什么

转载 作者:行者123 更新时间:2023-12-04 10:21:14 24 4
gpt4 key购买 nike

当使用 git push 时,我收到了以下一些控制台输出:

Locking support detected on remote "origin". Consider enabling it with:
$ git config lfs.https://127.0.0.1/foo/bar.git/info/lfs.locksverify true

我有点理解 LFS 锁应该做什么,但我不太确定如果我不启用它们会发生什么。他们在服务器上启用了吗?还是在客户端?任何人都可以阐明这一点吗?如果可能的话,我应该始终启用它吗?谢谢!

最佳答案

我相信锁定是在 git 服务器上实现的,但不同的 git 主机可能会以不同的方式实现它,或者还不支持它。在本地,您可以配置您的存储库以在推送之前检查远程锁定。我假设如果这没有在本地配置,你的 git 命令仍然会在 git push 上传输大文件,即使它们被锁定在服务器中,如果你的远程主机服务器没有实现早期验证,这可能只会浪费你的时间和网络.

我认为此设置只是解决不同提供商(GitHub、bitbucket、gitlab、azure)实现锁定方式不一致的一种解决方法。

似乎默认值为 null,如果为 null,git lfs 将根据服务器响应自动设置为 true 或 false。

来自 https://manpages.debian.org/testing/git-lfs/git-lfs-config.5.en.html

lfs.<url>.locksverify Determines whether locks are checked before Git pushes. This prevents you from pushing changes to files that other users have locked. The Git LFS pre-push hook varies its behavior based on the value of this config key.

  • null - In the absence of a value, Git LFS will attempt the call, and warn if it returns an error. If the response is valid, Git LFS will set the value to true, and will halt the push if the user attempts to update a file locked by another user. If the server returns a 501 Not Implemented response, Git LFS will set the value to false.
  • true - Git LFS will attempt to verify locks, halting the Git push if there are any server issues, or if the user attempts to update a file locked by another user.
  • false - Git LFS will completely skip the lock check in the pre-push hook. You should set this if you´re not using File Locking, or your Git server verifies locked files on pushes automatically.

来自 https://github.com/git-lfs/git-lfs/wiki/File-Locking :

Since File Locking is an early release, and few LFS servers implement the API, Git LFS won't halt your push if it cannot verify locked files. You'll see a message like this:

$ git lfs push origin master --all

Remote "origin" does not support the LFS locking API. Consider disabling it with ...

关于git - 如果我没有 git lfs lock 会发生什么,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60840963/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com