Gitlab: Access git lfs files through deploy keys

时间:2017-07-12 08:10:30

标签: gitlab git-lfs

I am using Gitlab Community Edition 8.13.7 and want to switch our projects to use git lfs.

I setup a test project with git-lfs which works fine with cloning, pushing and pulling with git-lfs. Once the same project is used on our jenkins-ci cloning fails.

Before installing git-lfs on the jenkins machine I could clone the project fine and would see that the binary was replaced with a pointer file.

cat image.iso
version https://git-lfs.github.com/spec/v1
oid sha256:1e1c4ea8348914d81385e4801de6ba34baa6ed6c4eb4f4cd026d0659eaa459de
size 111691252

After installing git-lfs I get the following error:

stderr: Downloading image.iso (112 MB)
Error downloading object: image.iso (1e1c4ea): Smudge error: 
Error downloading image.iso (1e1c4ea8348914d81385e4801de6ba34baa6ed6c4eb4f4cd026d0659eaa459de): batch response:
Fatal error: Server error: http://gitlab-01.carsten.net/carsten/testing-lfs.git/info/lfs/objects/batch
Errors logged to /data/jenkins/tkn-01/lygteskov-test-lfs/.git/lfs/objects/logs/20170711T155641.879051717.log
Use `git lfs logs last` to view the log.
error: external filter git-lfs smudge -- %f failed 2
error: external filter git-lfs smudge -- %f failed
fatal: image.iso: smudge filter lfs failed` 

Output from git lfs logs last:

git-lfs/2.2.1 (GitHub; linux amd64; go 1.8.3; git 621d1f82)
git version 2.0.5

$ git-lfs smudge -- image.iso
Error downloading object: image.iso (1e1c4ea): Smudge error: Error downloading image.iso (1e1c4ea8348914d81385e4801de6ba34baa6ed6c4eb4f4cd026d0659eaa459de): batch response: Fatal error: Server error: http://gitlab-01.carsten.net/carsten/testing-lfs.git/info/lfs/objects/batch

Server error: http://gitlab-01.carsten.net/carsten/testing-lfs.git/info/lfs/objects/batch
github.com/git-lfs/git-lfs/errors.Errorf
        /Users/ttaylorr/go/src/github.com/git-lfs/git-lfs/errors/errors.go:69
github.com/git-lfs/git-lfs/lfsapi.defaultError
        /Users/ttaylorr/go/src/github.com/git-lfs/git-lfs/lfsapi/errors.go:114
github.com/git-lfs/git-lfs/lfsapi.(*Client).handleResponse
        /Users/ttaylorr/go/src/github.com/git-lfs/git-lfs/lfsapi/errors.go:51
github.com/git-lfs/git-lfs/lfsapi.(*Client).Do
        /Users/ttaylorr/go/src/github.com/git-lfs/git-lfs/lfsapi/client.go:80
github.com/git-lfs/git-lfs/lfsapi.(*Client).doWithCreds
        /Users/ttaylorr/go/src/github.com/git-lfs/git-lfs/lfsapi/auth.go:74
github.com/git-lfs/git-lfs/lfsapi.(*Client).DoWithAuth
        /Users/ttaylorr/go/src/github.com/git-lfs/git-lfs/lfsapi/auth.go:44
github.com/git-lfs/git-lfs/tq.(*tqClient).Batch
        /Users/ttaylorr/go/src/github.com/git-lfs/git-lfs/tq/api.go:60
github.com/git-lfs/git-lfs/tq.Batch
        /Users/ttaylorr/go/src/github.com/git-lfs/git-lfs/tq/api.go:36
github.com/git-lfs/git-lfs/tq.(*TransferQueue).enqueueAndCollectRetriesFor
        /Users/ttaylorr/go/src/github.com/git-lfs/git-lfs/tq/transfer_queue.go:286
github.com/git-lfs/git-lfs/tq.(*TransferQueue).collectBatches
        /Users/ttaylorr/go/src/github.com/git-lfs/git-lfs/tq/transfer_queue.go:258
runtime.goexit
        /usr/local/Cellar/go/1.8.3/libexec/src/runtime/asm_amd64.s:2197
github.com/git-lfs/git-lfs/errors.newWrappedError
        /Users/ttaylorr/go/src/github.com/git-lfs/git-lfs/errors/types.go:170: Fatal error
github.com/git-lfs/git-lfs/errors.newWrappedError
        /Users/ttaylorr/go/src/github.com/git-lfs/git-lfs/errors/types.go:170: batch response
github.com/git-lfs/git-lfs/errors.newWrappedError
        /Users/ttaylorr/go/src/github.com/git-lfs/git-lfs/errors/types.go:170: Error downloading image.iso (1e1c4ea8348914d81385e4801de6ba34baa6ed6c4eb4f4cd026d0659eaa459de)
github.com/git-lfs/git-lfs/errors.newWrappedError
        /Users/ttaylorr/go/src/github.com/git-lfs/git-lfs/errors/types.go:170: Smudge error

ENV:
LocalWorkingDir=/data/jenkins/tkn-01/lygteskov-test-lfs
LocalGitDir=/data/jenkins/tkn-01/lygteskov-test-lfs/.git
LocalGitStorageDir=/data/jenkins/tkn-01/lygteskov-test-lfs/.git
LocalMediaDir=/data/jenkins/tkn-01/lygteskov-test-lfs/.git/lfs/objects
LocalReferenceDir=
TempDir=/data/jenkins/tkn-01/lygteskov-test-lfs/.git/lfs/tmp
ConcurrentTransfers=3
TusTransfers=false
BasicTransfersOnly=false
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_INTERNAL_GETTEXT_SH_SCHEME=gnu
GIT_DIR=.git
GIT_REFLOG_ACTION=pull origin master
GIT_PREFIX=

1 个答案:

答案 0 :(得分:1)

通过将克隆的git url从ssh切换到http:

来解决问题