git-lfs checkout远程分支 [英] git-lfs checkout remote branch

查看:325
本文介绍了git-lfs checkout远程分支的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  git remote add remoteRepo git 

我尝试从使用lfs存储文件的远程计算机检出分支。 @ github.com:user / remoteRepo-lfs.git
git fetch remoteRepo
git checkout -b test remoteRepo / master

值得一提的是,remote已经被bozaro / git-lfs-migrate工具所接受。结帐过程会停止并显示错误,并且

  git lfs日志最后

pre>

显示:

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

$ git-lfs smudge - testText.log
下载对象:testText时出错。日志(dc56c0fc4d655b0895d83cd61b121f30cb74bda428655db4144e4a1c8b582b57)

涂抹错误:错误缓冲媒体文件:在服务器上找不到对象:
github.com/github/git-lfs/errors.newWrappedError
/用户/ 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 /人/项目/ 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 =原始
AccessDownload =无
AccessUpload =无
DownloadTransfers =基本
UploadTransfers = basic
GIT_DIR = .git
GIT_PREFIX =

一个git -lfs env显示:

  git-lfs / 1.4.4(GitHub; linux amd64;去1.7.3; git cbf91a9)
git版本2.10.2

端点= https://github.com/username/repo.git/info/lfs(auth =无)
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 
code>

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

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

这似乎覆盖了原点的端点网址。有没有办法设置本地目录,以便我可以根据各自的终端URL从原始位置和远程位置推送/拉出/检出lfs文件?

解决方案

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

pre $ [filterlfs]
smudge = git-lfs smudge --skip%f
required = true
clean = git-lfs clean - %f

git-lfs涂抹将文件指针转换为实际文件。有了这个解决方法,我必须执行

  git lfs fetch 
$ b

后面跟着一个

  git lfs checkout 

检索/访问文件的内容。我不清楚为什么这种解决方法是必要的。通过关于git-lfs的问题,看起来这是一个正在进行的一般性工作。



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


I'm trying to checkout a branch from a remote that uses lfs to store files:

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

It is worth mentioning that the remote has been subject to the bozaro/git-lfs-migrate tool. The checkout process stops with an error and a

git lfs logs last

shows:

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=

A git-lfs env shows:

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"

I have cloned remoteRepo-lfs successfully with

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

and have also been able to successfully checkout the branch by specifying in a .lfsconfig file:

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

which seems to overwrite the endpoint url for origin. Is there a way to setup the local directory such that I can push/pull/checkout lfs files from origin and remotes based on their respective endpoint urls?

解决方案

I have found a workaround to this problem that I am encountering by modifying the lfs filter (in ~/.gitconfig). Namely:

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

git-lfs smudge converts the file pointers to the actual files. With this workaround, I have to perform a

git lfs fetch

followed by a

git lfs checkout

to retrieve/access the contents of the files. It is not clear to me why this workaround is necessary. Looking through the issues on the git-lfs, it seems like this is a general work in progress.

(e.g. https://github.com/github/git-lfs/issues/834).

这篇关于git-lfs checkout远程分支的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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