git-lfs checkout远程分支

时间:2016-11-02 18:36:03

标签: git github version-control git-lfs

我试图从使用lfs来存储文件的远程检出分支:

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

值得一提的是,遥控器一直受到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 env显示:

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。有没有办法设置本地目录,以便我可以根据各自的端点网址从源和远程推送/拉出/检出lfs文件?

2 个答案:

答案 0 :(得分: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)。

答案 1 :(得分:0)

你有没有安装过git-lfs?如果没有,您可以安装here。您似乎还没有 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 repo?您可以尝试使用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