How to add a remote to a repository with lfs?

本秂侑毒 提交于 2019-12-08 01:32:23

问题


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

And then on my SSD:

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

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.

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

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


回答1:


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

  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

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

  3. Add a user and a password
  4. 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/

Problems:

  • This is not a per-branch config. Be sure that it does not affect other branches (this is my case: other branches point to a different server, so I risk missing files on such server).
  • Don't know how to add ssh keys. If you do, tell us.
  • The docker container should run permanently.


来源:https://stackoverflow.com/questions/51295924/how-to-add-a-remote-to-a-repository-with-lfs

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!