【问题标题】:How to add a remote to a repository with lfs?如何使用 lfs 将远程添加到存储库?
【发布时间】:2018-12-20 02:40:20
【问题描述】:

我正在尝试设置这样的东西:我的 HDD 驱动器上的一个裸仓库和我的 SSD 上安装了 lfs 的克隆。我是这样做的:

首先我在我的硬盘上设置了一个裸仓库:

mkdir git_lfs_test.git
cd git_lfs_test.git
git init --bare

然后在我的 SSD 上:

git clone D:/Git/git_lfs_test.git
cd git_lfs_test
git lfs install
git lfs track '*.png'

完成此操作后,我在 GitKraken 中打开克隆的 repo。我进行初始提交,然后提交并推送 .gitattributes 文件。然后我创建一个 png 文件(GitKraken 将其识别为 lfs 文件)并将其推送到原点。它抛出这个错误:

Remote "origin" does not support the LFS locking API. Consider disabling it with:
$ git config lfs.D:/Git/git_lfs_test.git/info/lfs.locksverify false
batch request: missing protocol: "D:/Git/git_lfs_test.git/info/lfs"
exit

运行这行代码后,提示我仍然遇到同样的错误。

我是 git 新手,所以我可能会犯一些明显的错误,但我无法弄清楚它是什么。

我还想设置我的 lfs 缓存,以便它在 HDD 上,所以任何帮助都会很棒。

【问题讨论】:

    标签: git git-clone git-remote git-lfs gitkraken


    【解决方案1】:

    我有同样的问题,这是部分解决方案。

    1. 运行本地 dockerized lfs-server 将数据保存在某处,例如/var/LFS/LOCAL/REPOSITORY/,随意更改。

      docker run -d --rm -v /var/LFS/LOCAL/REPOSITORY/:/lfs -p 9999:9999 -t fjukstad/lfs-server

    2. 浏览管理界面http://127.0.0.1:9999/mgmt [admin/admin]

    3. 添加一个用户和一个密码
    4. 在你的 git 目录中,添加 lfs url(你可能想删除用户/密码,但它会一直询问你):

      git config lfs.url http://user:password@localhost:9999/

    问题

    • 这不是每个分支的配置。确保它不会影响其他分支(这是我的情况:其他分支指向不同的服务器,所以我冒着丢失此类服务器上的文件的风险)。
    • 不知道如何添加 ssh 密钥。如果有,请告诉我们。
    • docker 容器应该永久运行。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-10-03
      • 1970-01-01
      • 1970-01-01
      • 2011-07-05
      • 2015-12-16
      • 1970-01-01
      • 1970-01-01
      • 2021-02-16
      相关资源
      最近更新 更多