1

我正在尝试从使用 lfs 存储文件的远程检查分支:

git remote add remoteRepo git@github.com:user/remoteRepo-lfs.git
git fetch remoteRepo
git checkout -b test remoteRepo/master

值得一提的是,remote 已经受制于 bozaro/git-lfs-migrate 工具。结帐过程停止并出现错误和

git lfs logs last

显示:

git-lfs/1.4.4 (GitHub; linux amd64; go 1.7.3; git cbf91a9)
git version 2.10.2

$ git-lfs smudge -- testText.log
Error downloading object: testText.log (dc56c0fc4d655b0895d83cd61b121f30cb74bda428655db4144e4a1c8b582b57)

Smudge error: Error buffering media file: Object not found on the server.: 
github.com/github/git-lfs/errors.newWrappedError
    /Users/ttaylorr/dev/go/src/github.com/github/git-lfs/errors/types.go:166
github.com/github/git-lfs/errors.NewSmudgeError
    /Users/ttaylorr/dev/go/src/github.com/github/git-lfs/errors/types.go:252
github.com/github/git-lfs/lfs.PointerSmudge
    /Users/ttaylorr/dev/go/src/github.com/github/git-lfs/lfs/pointer_smudge.go:69
github.com/github/git-lfs/lfs.(*Pointer).Smudge
    /Users/ttaylorr/dev/go/src/github.com/github/git-lfs/lfs/pointer.go:64
github.com/github/git-lfs/commands.smudgeCommand
    /Users/ttaylorr/dev/go/src/github.com/github/git-lfs/commands/command_smudge.go:66
github.com/github/git-lfs/vendor/github.com/spf13/cobra.(*Command).execute
    /Users/ttaylorr/dev/go/src/github.com/github/git-lfs/vendor/github.com/spf13/cobra/command.go:477
github.com/github/git-lfs/vendor/github.com/spf13/cobra.(*Command).Execute
    /Users/ttaylorr/dev/go/src/github.com/github/git-lfs/vendor/github.com/spf13/cobra/command.go:551
github.com/github/git-lfs/commands.Run
    /Users/ttaylorr/dev/go/src/github.com/github/git-lfs/commands/run.go:65
main.main
    /Users/ttaylorr/dev/go/src/github.com/github/git-lfs/git-lfs.go:33
runtime.main
    /usr/local/Cellar/go/1.7.3/libexec/src/runtime/proc.go:183
runtime.goexit
    /usr/local/Cellar/go/1.7.3/libexec/src/runtime/asm_amd64.s:2086

ENV:
LocalWorkingDir=/home/person/Projects/proteus/proteus
LocalGitDir=/home/person/Projects/proteus/proteus/.git
LocalGitStorageDir=/home/person/Projects/proteus/proteus/.git
LocalMediaDir=/home/person/Projects/proteus/proteus/.git/lfs/objects
LocalReferenceDir=
TempDir=/home/person/Projects/proteus/proteus/.git/lfs/tmp
ConcurrentTransfers=3
TusTransfers=false
BasicTransfersOnly=false
BatchTransfer=true
SkipDownloadErrors=false
FetchRecentAlways=false
FetchRecentRefsDays=7
FetchRecentCommitsDays=0
FetchRecentRefsIncludeRemotes=true
PruneOffsetDays=3
PruneVerifyRemoteAlways=false
PruneRemoteName=origin
AccessDownload=none
AccessUpload=none
DownloadTransfers=basic
UploadTransfers=basic
GIT_DIR=.git
GIT_PREFIX=

一个 git-lfs 环境显示:

git-lfs/1.4.4 (GitHub; linux amd64; go 1.7.3; git cbf91a9)
git version 2.10.2

Endpoint=https://github.com/username/repo.git/info/lfs (auth=none)
  SSH=git@github.com:username/repo.git
Endpoint (remoterepo)=https://github.com/username/remoteRepo.git/info/lfs (auth=none)
  SSH=git@github.com:username/remoteRepo.git
LocalWorkingDir=/home/person/Projects/proteus/proteus
LocalGitDir=/home/person/Projects/proteus/proteus/.git
LocalGitStorageDir=/home/person/Projects/proteus/proteus/.git
LocalMediaDir=/home/person/Projects/proteus/proteus/.git/lfs/objects
LocalReferenceDir=
TempDir=/home/person/Projects/proteus/proteus/.git/lfs/tmp
ConcurrentTransfers=3
TusTransfers=false
BasicTransfersOnly=false
BatchTransfer=true
SkipDownloadErrors=false
FetchRecentAlways=false
FetchRecentRefsDays=7
FetchRecentCommitsDays=0
FetchRecentRefsIncludeRemotes=true
PruneOffsetDays=3
PruneVerifyRemoteAlways=false
PruneRemoteName=origin
AccessDownload=none
AccessUpload=none
DownloadTransfers=basic
UploadTransfers=basic
git config filter.lfs.smudge = "git-lfs smudge -- %f"
git config filter.lfs.clean = "git-lfs clean -- %f"

我已经成功克隆了 remoteRepo-lfs

git clone git@github.com:user/remoteRepo-lfs.git

并且还能够通过在 .lfsconfig 文件中指定来成功签出分支:

[lfs]
  url = https://github.com/username/remoteRepo-lfs.git
[remote "remoteRepo"]
  lfsurl = https://github.com/username/remoteRepo-lfs.git/info/lfs

这似乎覆盖了原点的端点 url。有没有办法设置本地目录,以便我可以根据各自的端点 url 从源和远程推送/拉取/签出 lfs 文件?

4

2 回答 2

2

我通过修改 lfs 过滤器(在 ~/.gitconfig 中)找到了解决此问题的方法。即:

[filter "lfs"]
  smudge = git-lfs smudge --skip %f
  required = true
  clean = git-lfs clean -- %f

git-lfs smudge 将文件指针转换为实际文件。使用此解决方法,我必须执行

git lfs fetch

其次是

git lfs checkout

检索/访问文件的内容。我不清楚为什么需要这种解决方法。查看 git-lfs 上的问题,这似乎是一项正在进行的一般工作。

(例如https://github.com/github/git-lfs/issues/834)。

于 2016-11-09T16:25:54.683 回答
0

你安装过 git-lfs 吗?如果没有,你可以在这里安装。看来你还没有GIT_LFS_PATH,可以参考我自己的环境。

DownloadTransfers=basic
UploadTransfers=basic
GIT_LFS_PATH=C:\Program Files\Git LFS
git config filter.lfs.smudge = "git-lfs smudge -- %f"
git config filter.lfs.clean = "git-lfs clean -- %f"

你在 GitHub 上创建了一个 git-lfs 存储库吗?您可以尝试使用https://github.com/username/remoteRepo-lfs.git来检查它是否真的存在。

而且我也很困惑,您的本地目录如下:

LocalWorkingDir=/home/person/Projects/proteus/proteus
LocalGitDir=/home/person/Projects/proteus/proteus/.git
LocalGitStorageDir=/home/person/Projects/proteus/proteus/.git
LocalMediaDir=/home/person/Projects/proteus/proteus/.git/lfs/objects
LocalReferenceDir=
TempDir=/home/person/Projects/proteus/proteus/.git/lfs/tmp

我的本地目录是这样的:

LocalWorkingDir=C:\Users\TFSTest\New folder\Git2
LocalGitDir=C:\Users\TFSTest\New folder\Git2\.git
LocalGitStorageDir=C:\Users\TFSTest\New folder\Git2\.git
LocalMediaDir=C:\Users\TFSTest\New folder\Git2\.git\lfs\objects
LocalReferenceDir=
TempDir=C:\Users\TFSTest\New folder\Git2\.git\lfs\tmp
于 2016-11-04T05:42:02.660 回答