如何使用lfs将远程添加到资源库? [英] How to add a remote to a repository with lfs?

查看:219
本文介绍了如何使用lfs将远程添加到资源库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试设置以下内容:在HDD驱动器上安装一个裸仓库,并在安装了lfs的SSD上对其进行克隆.我正在这样做:

I'm trying to set up something like this: a bare repo on my HDD drive and a clone of it on my SSD with lfs installed. I'm doing it like this:

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

First I set up a bare repo on my HDD:

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中打开克隆的存储库.我进行初始提交,然后提交并推送.gitattributes文件.然后,我创建一个png文件(GitKraken将该文件识别为lfs文件)并将其推送到原点.它引发此错误:

After doing this I open the cloned repo in GitKraken. I make the initial commit and then commit and push the .gitattributes file. Then I create a png file (which GitKraken recognises as a lfs file) and push it to the origin. It throws this error:

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

运行代码行后,这表明我仍然遇到相同的错误.

After running the line of code it suggests I still get the same error.

我是git的新手,所以我很可能会犯一些明显的错误,但我不知道这是什么.

I'm new to git so I'm probalby making some obvious mistake, but I can't figure out what it is.

我也想设置我的lfs缓存,使其位于HDD上,因此这方面的任何帮助都将很棒.

Also I want to set up my lfs cache so it is on the HDD so any help on that would be great.

推荐答案

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

I have the same problem, and this is a partial solution.

  1. 运行本地dockerized lfs服务器,将数据保存在某个地方,例如/var/LFS/LOCAL/REPOSITORY/,根据需要进行更改.

  1. Run a local dockerized lfs-server saving the data somewhere, e.g. /var/LFS/LOCAL/REPOSITORY/, change it as you like.

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

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

浏览管理界面,网址为 http://127.0.0.1:9999/mgmt [admin/admin]

Browse the management interface at http://127.0.0.1:9999/mgmt [admin/admin]

在您的git目录中,添加lfs网址(您可能希望删除用户名/密码,但会不断询问您):

In your git directory, add the lfs url (you might want to remove the user/password, but it will keep asking you):

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

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

问题:

  • 这不是每个分支的配置.确保它不会影响其他分支(这是我的情况:其他分支指向另一台服务器,所以我冒着丢失该服务器上文件的风险).
  • 不知道如何添加ssh密钥.如果您愿意,请告诉我们.
  • 泊坞窗容器应永久运行.

这篇关于如何使用lfs将远程添加到资源库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆