用LFS初始化裸git存储库 [英] Initialize bare git repository with LFS

查看:256
本文介绍了用LFS初始化裸git存储库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在支持git LFS协议的外部驱动器(git init --bare reponame)上初始化几个本地git存储库.IE.克隆这些文件之后,我希望能够通过LFS跟踪大文件(然后文件的版本应存储在外部驱动器上)

不执行任何其他步骤就无法执行此操作(即克隆空存储库,使用git LFS跟踪大文件,然后尝试将其推送到远程):

  Git LFS:(122个文件中的0个)0 B/157.56 MBhttp:发布/media/me/bigdrive/git_repos/coding.git/info/lfs/objects/batch:不支持的协议方案"http:发布/media/me/bigdrive/git_repos/coding.git/info/lfs/objects/batch:不支持的协议方案"错误:无法将某些引用推送到'/media/me/bigdrive/git_repos/coding'` 

我没有找到有关如何执行此操作的指南,LFS手册页似乎没有提供解决方案.GitHub/BitBucket指南仅说明了如何在本地存储库上执行此操作,然后将其推送到服务器上正确配置的git存储库

感谢您的帮助,谢谢!

解决方案

我遇到了类似的问题,但设法使其正常工作.

第1步:

下载并启动LFS服务器(如果尚未启动),例如

结果看起来很有希望:

 <代码> C:\ Users \ Nick \ Desktop \ WorkingCopy \ Repo> git push origin master警告:当前的Git远程包含凭据警告:当前的Git远程包含凭据Git LFS:(1个文件中的1个)6.72 KB/6.72 KB计数对象:3,完成.增量压缩最多使用8个线程.压缩对象:100%(3/3),已完成.写入对象:100%(3/3),428个字节|0字节/秒,完成.总计3(增量0),已重用0(增量0)到C:/Users/Nick/Desktop/WorkingCopy/../Repo309629f..7fe106d主->掌握 

LFS服务器的lfs-content文件夹现在包含一个文件,其大小与添加文件的大小完全相同.

I'd like to initialize several local git repositories on an external drive (git init --bare reponame) supporting git LFS protocol. I.e. after cloning these, I'd like to be able to track large files via LFS (the version of the files should then be stored on the external drive)

Doing this without any additional steps did not work (i.e. clone empty repo, track large files with git LFS, and try to push to remote):

Git LFS: (0 of 122 files) 0 B / 157.56 MB
http: Post /media/me/bigdrive/git_repos/coding.git/info/lfs/objects/batch:
      unsupported protocol scheme ""
http: Post /media/me/bigdrive/git_repos/coding.git/info/lfs/objects/batch:
      unsupported protocol scheme ""
error: failed to push some refs to '/media/me/bigdrive/git_repos/coding'`

I found no guide on how to do this and the LFS man page did not seem to provide a solution. The GitHub/BitBucket guides only explain how to do this on a local repository and then pushing to a correctly configured git repository on their servers

Appreciate any help, thanks!

解决方案

I had similar issues, but managed to get it working.

Step 1:

Download and start an LFS server (if you haven't already done so), such as https://github.com/git-lfs/lfs-test-server (Don't use this one in production.)

Step 2:

Correctly set up the LFS server URL for your repo, as described here: https://github.com/git-lfs/git-lfs/wiki/Tutorial#lfs-url

In my case, running the following in my working copy folder was enough:

git config -f .lfsconfig lfs.url http://username:password@localhost:8080
git add .lfsconfig

Replace username and password by your desired credentials, and localhost:8080 by your Git server URL.

You can run git lfs env to verify your results.

Step 3:

Set up your LFS_ADMINUSER and LFS_ADMINPASS environment variables as described here: https://github.com/git-lfs/lfs-test-server#running

Then, you should be able to visit http://localhost:8080/mgmt (or wherever your LFS server is running) in your browser and add your credentials.

The results look promising:

C:\Users\Nick\Desktop\WorkingCopy\Repo>git push origin master
warning: current Git remote contains credentials
warning: current Git remote contains credentials
Git LFS: (1 of 1 files) 6.72 KB / 6.72 KB
Counting objects: 3, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 428 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To C:/Users/Nick/Desktop/WorkingCopy/../Repo
   309629f..7fe106d  master -> master

The lfs-content folder of the LFS server now contains a file with the exact size of the added file.

这篇关于用LFS初始化裸git存储库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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