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

时间:2021-05-18 08:04:36

标签: git repository push git-lfs bare

描述问题 无法推送到裸仓库

我是git新手,不知道我的操作对不对。

  1. 在A电脑创建一个裸repo,安装lfs,然后将文件夹共享到本地网络
  2. 将裸仓库克隆到计算机 B 并安装 lfs,使用 Board <- function(player, header = FALSE) { if (header) { cat(" Name") for (name in colnames(player)) { cat(" ") cat(format(name, width = 4, justify = "right")) } cat("\n") } cat(strtrim(paste(rownames(player), " "), 7)) for (i in 1:length(player)) { cat(" ") cat(format(as.character(player[i]), width = 4, justify = "right")) } } Board(playerA, header = TRUE) # Name 0s 1s 2s 3s 5s X Out Tot #T Smith 0 0 0 0 0 0 0 0 0 跟踪文件
  3. git lfs track "*.psd"git add .
  4. 对 psd 文件进行一些更改
  5. git commit -m 'lfs setup'git add .
  6. git commit -m 'some changes'

然后…………

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

工作仓库中的git lfs env(非裸):

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"

2 个答案:

答案 0 :(得分:0)

Git LFS 是 Git 的扩展,它不是 git 本身的一部分。它基本上是一个存储大文件的 HTTP 服务器,而只有元数据被推送到存储库。 LFS 服务器 API 记录在 here

如果你想使用本地裸仓库,你可以使用 lfs-test-server 作为本地 LFS 服务器。 它仅应用于测试目的,尚未准备好生产。如果您需要一个生产就绪的 LFS 服务器,您应该考虑自托管 Gitlab 或 Gitea 实例(如果需要,它们可以托管在您的本地机器上)。

答案 1 :(得分:0)

Git LFS 支持本地 file URL,并且可以将对象推送到本地存储库或从本地存储库推送对象,但它目前不处理 Windows SMB 路径语法。那是因为没有核心开发人员使用该功能,也没有人发送补丁来实现它。

Git LFS 的下一个版本 3.0.0,如果您为 SMB 共享分配一个驱动器号,应该可以正确处理它,如果您在远程端安装合适的服务器,它也将支持通过 SSH 的连接。前者已在 main 分支中可用,后者将很快推出。