有没有办法将git lfs推送到裸仓库

jucafojl  于 12个月前  发布在  Git
关注(0)|答案(3)|浏览(140)

描述问题无法推送到裸库

我刚接触git,不知道我的操作是否正确。
1.在计算机A中创建一个空存储库,安装lfs,然后将该文件夹共享到本地网络
1.将bare repo克隆到计算机B并安装lfs,使用git lfs track "*.psd"跟踪文件

  1. git add .git commit -m 'lfs setup'
    1.做一些改变到psd文件
  2. git add .git commit -m 'some changes'
  3. git push origin master
    从那以后... ...
$ git push
Uploading LFS objects: 100% (4/4), 46 MB | 0 B/s, done.
EOF
error: failed to push some refs to '<bare repo path>'

我不知道有没有这样的方法可以解决这个问题?

git lfs env的输出

git lfs env in bare repo:

git-lfs/2.13.3 (GitHub; windows amd64; go 1.16.2; git a5e65851)
git version 2.31.1.windows.1

LocalWorkingDir=
LocalGitDir=<bare repo path>
LocalGitStorageDir=<bare repo path>
LocalMediaDir=<bare repo path>\lfs\objects
LocalReferenceDirs=
TempDir=<bare repo path>\lfs\tmp
ConcurrentTransfers=8
TusTransfers=false
BasicTransfersOnly=false
SkipDownloadErrors=false
FetchRecentAlways=false
FetchRecentRefsDays=7
FetchRecentCommitsDays=0
FetchRecentRefsIncludeRemotes=true
PruneOffsetDays=3
PruneVerifyRemoteAlways=false
PruneRemoteName=origin
LfsStorageDir=<bare repo path>\lfs
AccessDownload=none
AccessUpload=none
DownloadTransfers=basic,lfs-standalone-file
UploadTransfers=basic,lfs-standalone-file
GIT_EXEC_PATH=C:/Program Files/Git/mingw64/libexec/git-core
git config filter.lfs.process = "git-lfs filter-process"
git config filter.lfs.smudge = "git-lfs smudge -- %f"
git config filter.lfs.clean = "git-lfs clean -- %f"

git lfs env in the working repo(non bare):

git-lfs/2.13.3 (GitHub; windows amd64; go 1.16.2; git a5e65851)
git version 2.31.1.windows.1

Endpoint=file:///<bare repo path> (auth=none)
LocalWorkingDir=
LocalGitDir=D:\lfs-repo\.git
LocalGitStorageDir=D:\lfs-repo\.git
LocalMediaDir=D:\lfs-repo\.git\lfs\objects
LocalReferenceDirs=
TempDir=D:\lfs-repo\.git\lfs\tmp
ConcurrentTransfers=8
TusTransfers=false
BasicTransfersOnly=false
SkipDownloadErrors=false
FetchRecentAlways=false
FetchRecentRefsDays=7
FetchRecentCommitsDays=0
FetchRecentRefsIncludeRemotes=true
PruneOffsetDays=3
PruneVerifyRemoteAlways=false
PruneRemoteName=origin
LfsStorageDir=D:\lfs-repo\.git\lfs
AccessDownload=none
AccessUpload=none
DownloadTransfers=basic,lfs-standalone-file
UploadTransfers=basic,lfs-standalone-file
GIT_EXEC_PATH=C:/Program Files/Git/mingw64/libexec/git-core
git config filter.lfs.process = "git-lfs filter-process"
git config filter.lfs.smudge = "git-lfs smudge -- %f"
git config filter.lfs.clean = "git-lfs clean -- %f"
7xzttuei

7xzttuei1#

Git LFS支持本地file URL,可以将对象推送到本地存储库或从本地存储库推送对象,但它目前不处理Windows SMB路径语法。这是因为没有核心开发人员使用该功能,也没有人发送补丁来实现它。
Git LFS的下一个版本3.0.0应该可以正确地处理它,如果您为SMB共享分配了一个驱动器号,并且如果您在远程端安装了合适的服务器,它也将支持通过SSH的连接。前者已经在main分支中可用,后者将很快推出。

zkure5ic

zkure5ic2#

Git LFS是Git的一个扩展,它不是git本身的一部分。它基本上是一个存储大型文件的HTTP服务器,而只有元数据被推送到存储库。这里记录了LFS服务器API。
如果您想使用本地裸存储库,可以使用lfs-test-server作为本地LFS服务器。它仅用于测试目的,不适合生产。如果你需要一个生产就绪的LFS服务器,你应该考虑自托管Gitlab或Gitea示例(如果需要,它们可以托管在你的本地机器上)。

xdnvmnnf

xdnvmnnf3#

我今天遇到了这个问题,正如@bk2204所指出的,这是SMB路径的问题。

我最终能够用这个github问题中的信息解决它。我在本地仓库的根目录中添加了一个.lfsconfig文件,其中包含以下内容,并在推送实际的LFS文件之前推送了它:

[lfs]
    url = file:////<ip_of_server>/<path_to_directory>

注意**file:////前缀**,这是重要的部分-使用//将不起作用。

相关问题