git lfs push fails.

894 views
Skip to first unread message

Yingchun Li

unread,
Jul 20, 2022, 8:57:29 AM7/20/22
to Repo and Gerrit Discussion
Hi,
    I installed the gerrit lfs plugin,  Now when I push the binary file to the gerrit project,
the client would fail immediately:

git push origin HEAD:master

batch response: Authentication required: Authorization error: http://my_git_server/lfs-test/info/lfs/objects/batch                                                    
Check that you have proper access to the repository
Uploading LFS objects:   0% (0/1), 0 B | 0 B/s, done.
error: failed to push some refs to 'ssh://172.16.10.40:29418/lfs-test'

The verbose git trace:
GIT_TRACE=1 git push origin HEAD:master
20:45:13.074283 git.c:455               trace: built-in: git push origin HEAD:master
20:45:13.075298 run-command.c:668       trace: run_command: unset GIT_PREFIX; ssh -p 29418 user@my_git_server 'git-receive-pack '\''/lfs-test'\'''
20:45:13.565720 run-command.c:668       trace: run_command: .git/hooks/pre-push origin ssh://USER@my_git_server:29418/lfs-test
20:45:13.570850 git.c:742               trace: exec: git-lfs pre-push origin ssh://USER@my_git_server:29418/lfs-test
20:45:13.570960 run-command.c:668       trace: run_command: git-lfs pre-push origin ssh://USER@my_git_server:29418/lfs-test
20:45:13.580772 trace git-lfs: exec: git 'version'
20:45:13.585004 trace git-lfs: exec: git '-c' 'filter.lfs.smudge=' '-c' 'filter.lfs.clean=' '-c' 'filter.lfs.process=' '-c' 'filter.lfs.required=false' 'remote' '-v'
20:45:13.589260 trace git-lfs: exec: git '-c' 'filter.lfs.smudge=' '-c' 'filter.lfs.clean=' '-c' 'filter.lfs.process=' '-c' 'filter.lfs.required=false' 'remote'
20:45:13.593383 trace git-lfs: exec: git '-c' 'filter.lfs.smudge=' '-c' 'filter.lfs.clean=' '-c' 'filter.lfs.process=' '-c' 'filter.lfs.required=false' 'rev-parse' 'HEAD' '--symbolic-full-name' 'HEAD'
20:45:13.598006 trace git-lfs: exec: git '-c' 'filter.lfs.smudge=' '-c' 'filter.lfs.clean=' '-c' 'filter.lfs.process=' '-c' 'filter.lfs.required=false' 'rev-parse' '--git-dir' '--show-toplevel'
20:45:13.602456 trace git-lfs: exec: git 'config' '--includes' '-l'
20:45:13.606379 trace git-lfs: exec: git 'rev-parse' '--is-bare-repository'
20:45:13.610129 trace git-lfs: exec: git 'config' '--includes' '-l' '--blob' ':.lfsconfig'
20:45:13.614334 trace git-lfs: exec: git 'config' '--includes' '-l' '--blob' 'HEAD:.lfsconfig'
20:45:13.619503 trace git-lfs: attempting pure SSH protocol connection
20:45:13.619593 trace git-lfs: run_command: ssh -p 29418 USER@my_git_server git-lfs-transfer /lfs-test upload
20:45:13.619811 trace git-lfs: exec: ssh '-p' '29418' 'USER@my_git_server' 'git-lfs-transfer /lfs-test upload'
20:45:14.112463 trace git-lfs: pure SSH protocol connection failed: Unable to negotiate version with remote side (unable to read capabilities): EOF
20:45:14.113163 trace git-lfs: pre-push: HEAD 9e52d0cca3efa92e16ef3a710cbf773c052b112d refs/heads/master 76ffb65459b19f1020251007b2195a3c13d7614f
20:45:14.113361 trace git-lfs: exec: git '-c' 'filter.lfs.smudge=' '-c' 'filter.lfs.clean=' '-c' 'filter.lfs.process=' '-c' 'filter.lfs.required=false' 'show-ref'
20:45:14.118373 trace git-lfs: exec: git '-c' 'filter.lfs.smudge=' '-c' 'filter.lfs.clean=' '-c' 'filter.lfs.process=' '-c' 'filter.lfs.required=false' 'ls-remote' '--heads' '--tags' '-q' 'origin'
20:45:14.710244 trace git-lfs: tq: running as batched queue, batch size of 100
20:45:14.710332 trace git-lfs: run_command: git rev-list --objects --ignore-missing --stdin --
20:45:14.710347 trace git-lfs: exec: git '-c' 'filter.lfs.smudge=' '-c' 'filter.lfs.clean=' '-c' 'filter.lfs.process=' '-c' 'filter.lfs.required=false' 'rev-list' '--objects' '--ignore-missing' '--stdin' '--'
20:45:14.710638 trace git-lfs: exec: git '-c' 'filter.lfs.smudge=' '-c' 'filter.lfs.clean=' '-c' 'filter.lfs.process=' '-c' 'filter.lfs.required=false' 'cat-file' '--batch-check'
20:45:14.710892 trace git-lfs: exec: git '-c' 'filter.lfs.smudge=' '-c' 'filter.lfs.clean=' '-c' 'filter.lfs.process=' '-c' 'filter.lfs.required=false' 'rev-parse' '--git-common-dir'
20:45:14.711984 trace git-lfs: tq: sending batch of size 1
20:45:14.712061 trace git-lfs: run_command: ssh -p 29418 USER@my_git_server git-lfs-authenticate /lfs-test upload                                                
20:45:14.712092 trace git-lfs: exec: ssh '-p' '29418' 'USER@my_git_server' 'git-lfs-authenticate /lfs-test upload'
20:45:15.190908 trace git-lfs: api: batch 1 files
20:45:15.192304 trace git-lfs: HTTP: POST http://my_git_server/lfs-test/info/lfs/objects/batch
20:45:15.259620 trace git-lfs: HTTP: 401
20:45:15.259760 trace git-lfs: api error: Authentication required: Authorization error: http://my_git_server/lfs-test/info/lfs/objects/batch
Check that you have proper access to the repository
batch response: Authentication required: Authorization error: http://my_git_server/lfs-test/info/lfs/objects/batch
Check that you have proper access to the repository

But I am sure I can login the gerrit server, and has the access to the repo.

the env of git lfs:
git lfs env

git-lfs/3.2.0 (GitHub; linux amd64; go 1.18.2)
git version 2.34.1

Endpoint=https://172.16.10.40/lfs-test.git/info/lfs (auth=basic)
  SSH=yingc...@172.16.10.40:/lfs-test
LocalWorkingDir=/home/liyc/temp/ssh/lfs-test
LocalGitDir=/home/liyc/temp/ssh/lfs-test/.git
LocalGitStorageDir=/home/liyc/temp/ssh/lfs-test/.git
LocalMediaDir=/home/liyc/temp/ssh/lfs-test/.git/lfs/objects
LocalReferenceDirs=
TempDir=/home/liyc/temp/ssh/lfs-test/.git/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=/home/liyc/temp/ssh/lfs-test/.git/lfs
AccessDownload=basic
AccessUpload=basic
DownloadTransfers=basic,lfs-standalone-file,ssh
UploadTransfers=basic,lfs-standalone-file,ssh
GIT_EXEC_PATH=/usr/lib/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"

From the server side error log:
cat /var/log/apache2/gerrit_error.log
it did show something wrong:
[Wed Jul 20 20:42:20.324462 2022] [auth_basic:error] [pid 770077:tid 139668444149504] [client 192.168.11.44:54170] AH01614: client used wrong authentication scheme: /lfs-test/info/lfs/objects/batch
[Wed Jul 20 20:45:15.244660 2022] [auth_basic:error] [pid 770077:tid 139668418971392] [client 192.168.11.44:54172] AH01614: client used wrong authentication scheme: /lfs-test/info/lfs/objects/batch


My gerrit server is 3.4.3, and use the http as the auth, the config is:

[auth]
    type = HTTP
    emailFormat = {0}@xxxx.com
    gitBasicAuthPolicy = HTTP
    trustContainerAuth = true

[httpd]
    maxThreads = 50
    listenUrl = proxy-http://127.0.0.1:8081/

[lfs]
    plugin=lfs

Anyone has some clue? Thanks a lot.

Yingchun Li

unread,
Jul 20, 2022, 9:03:59 AM7/20/22
to Repo and Gerrit Discussion
More info,
The apache2 config:
<VirtualHost *:80>
    ServerName 172.16.10.40
    ServerAdmin ger...@172.16.10.40

    ProxyRequests Off
    ProxyVia Off
    ProxyPreserveHost On

    <Proxy http://127.0.0.1:8081/*>
        AuthType Basic
        AuthName "Gerrit Code Review"
        Require valid-user
        AuthUserFile /home/gerrit/gerrit-home/etc/gerrit.passwd

        Order deny,allow
        Allow from all
    </Proxy>

    AllowEncodedSlashes On
    ProxyPass / http://127.0.0.1:8081/ nocanon

    ErrorLog ${APACHE_LOG_DIR}/gerrit_error.log
    CustomLog ${APACHE_LOG_DIR}/gerrit_access.log combined

</VirtualHost>

And my local git client config:
git config --list

filter.lfs.clean=git-lfs clean -- %f
filter.lfs.smudge=git-lfs smudge -- %f
filter.lfs.process=git-lfs filter-process
filter.lfs.required=true

credential.https://github.com.helper=
credential.https://github.com.helper=!/usr/bin/gh auth git-credential
filter.lfs.clean=git-lfs clean -- %f
filter.lfs.smudge=git-lfs smudge -- %f
filter.lfs.process=git-lfs filter-process
filter.lfs.required=true
credential.helper=store
core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true
remote.origin.url=ssh://USER@my_git_server:29418/lfs-test
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
branch.master.remote=origin
branch.master.merge=refs/heads/master
lfs.repositoryformatversion=0
lfs.https://my_git_server/lfs-test.git/info/lfs.access=basic
lfs.https://my_git_server/lfs-test.git/info/lfs.locksverify=false
Reply all
Reply to author
Forward
0 new messages