git-lfs / git-lfs

Git extension for versioning large files
https://git-lfs.com
Other
12.93k stars 2.03k forks source link

1.0.1 breaks clone #800

Closed gogodave closed 8 years ago

gogodave commented 9 years ago

I can clone a repo using git-lfs 1.0.0. After upgrading to 1.0.1, cloning the same repo gives the error below. Reverting to 1.0.0 fixes the issue.

❯ git lfs logs last
git-lfs/1.0.1 (GitHub; linux amd64; go 1.5.1; git a999185)
git version 2.4.8

$ git-lfs smudge out/bzImage
Error accessing media: out/bzImage (7011e311055932c24a68ff96ad275e3fc635ad8be504e670c125ab704c7285a4)

Server Error
Docs: https://github.com/contact
goroutine 1 [running]:
github.com/github/git-lfs/lfs.Stack(0x0, 0x0, 0x0)
        /tmp/docker_run/git-lfs/rpm/BUILD/git-lfs-1.0.1/src/github.com/github/git-lfs/lfs/errors.go:557 +0x80
github.com/github/git-lfs/commands.logPanicToWriter(0x7f29505a91e8, 0xc8200c60a8, 0x7f294df67e50, 0xc82040e9f0)
        /tmp/docker_run/git-lfs/rpm/BUILD/git-lfs-1.0.1/src/github.com/github/git-lfs/commands/commands.go:184 +0xf7f
github.com/github/git-lfs/commands.logPanic(0x7f294df67e50, 0xc82040e9f0, 0x0, 0x0)
        /tmp/docker_run/git-lfs/rpm/BUILD/git-lfs-1.0.1/src/github.com/github/git-lfs/commands/commands.go:148 +0x421
github.com/github/git-lfs/commands.handlePanic(0x7f294df67e50, 0xc82040e9f0, 0x0, 0x0)
        /tmp/docker_run/git-lfs/rpm/BUILD/git-lfs-1.0.1/src/github.com/github/git-lfs/commands/commands.go:123 +0x4e
github.com/github/git-lfs/commands.LoggedError(0x7f294df67e50, 0xc82040e9f0, 0x8e6540, 0x1e, 0xc82054bca8, 0x2, 0x2)
        /tmp/docker_run/git-lfs/rpm/BUILD/git-lfs-1.0.1/src/github.com/github/git-lfs/commands/commands.go:73 +0x82
github.com/github/git-lfs/commands.smudgeCommand(0xabe0e0, 0xc8200b4140, 0x1, 0x1)
        /tmp/docker_run/git-lfs/rpm/BUILD/git-lfs-1.0.1/src/github.com/github/git-lfs/commands/command_smudge.go:80 +0xd89
github.com/github/git-lfs/vendor/_nuts/github.com/spf13/cobra.(*Command).execute(0xabe0e0, 0xc8200b4090, 0x1, 0x1, 0x0, 0x0)
        /tmp/docker_run/git-lfs/rpm/BUILD/git-lfs-1.0.1/src/github.com/github/git-lfs/vendor/_nuts/github.com/spf13/cobra/command.go:477 +0x40
github.com/github/git-lfs/vendor/_nuts/github.com/spf13/cobra.(*Command).Execute(0xabede0, 0x0, 0x0)
        /tmp/docker_run/git-lfs/rpm/BUILD/git-lfs-1.0.1/src/github.com/github/git-lfs/vendor/_nuts/github.com/spf13/cobra/command.go:551 +0x46
github.com/github/git-lfs/commands.Run()
        /tmp/docker_run/git-lfs/rpm/BUILD/git-lfs-1.0.1/src/github.com/github/git-lfs/commands/commands.go:88 +0x23
main.main()
        /tmp/docker_run/git-lfs/rpm/BUILD/git-lfs-1.0.1/git-lfs.go:34 +0x12e

ENV:
LocalWorkingDir=/home/dgaulke/local/test-clone
LocalGitDir=.git
LocalGitStorageDir=.git
LocalMediaDir=.git/lfs/objects
TempDir=.git/lfs/tmp
ConcurrentTransfers=3
BatchTransfer=true
GIT_DIR=.git
strich commented 9 years ago

I can confirm the same thing happens with:

git init
git fetch [remote URL here]
git checkout -f [commit ID here]
# Failure occurs on first instance of an LFS managed file during checkout here.

Detailed log:

git-lfs/1.0.1 (GitHub; windows amd64; go 1.5.1; git 2182d86)
git version 2.6.2.windows.1

$ git-lfs.exe smudge Prototype/Assets/CalibrationScene/Model/CalibrationScaleRGB.fbx
Error accessing media: Prototype/Assets/CalibrationScene/Model/CalibrationScaleRGB.fbx (63bb6517546decd104f3bd99b8809bcc4bb57f3181c636bf4cd7b4f2ac6425f4)

Post objects/batch: unsupported protocol scheme ""
goroutine 1 [running]:
github.com/github/git-lfs/lfs.Stack(0x0, 0x0, 0x0)
    C:/Users/techn/go/src/github.com/github/git-lfs/lfs/errors.go:557 +0x87
github.com/github/git-lfs/commands.logPanicToWriter(0xdf41e8, 0xc082028218, 0xdf4d18, 0xc08210e640)
    C:/Users/techn/go/src/github.com/github/git-lfs/commands/commands.go:184 +0xf86
github.com/github/git-lfs/commands.logPanic(0xdf4d18, 0xc08210e640, 0x0, 0x0)
    C:/Users/techn/go/src/github.com/github/git-lfs/commands/commands.go:148 +0x428
github.com/github/git-lfs/commands.handlePanic(0xdf4d18, 0xc08210e640, 0x0, 0x0)
    C:/Users/techn/go/src/github.com/github/git-lfs/commands/commands.go:123 +0x55
github.com/github/git-lfs/commands.LoggedError(0xdf4d18, 0xc08210e640, 0x8ef020, 0x1e, 0xc08206dc78, 0x2, 0x2)
    C:/Users/techn/go/src/github.com/github/git-lfs/commands/commands.go:73 +0x89
github.com/github/git-lfs/commands.smudgeCommand(0xac3e20, 0xc0820078c0, 0x1, 0x1)
    C:/Users/techn/go/src/github.com/github/git-lfs/commands/command_smudge.go:80 +0xd90
github.com/github/git-lfs/vendor/_nuts/github.com/spf13/cobra.(*Command).execute(0xac3e20, 0xc082007810, 0x1, 0x1, 0x0, 0x0)
    C:/Users/techn/go/src/github.com/github/git-lfs/vendor/_nuts/github.com/spf13/cobra/command.go:477 +0x40a
github.com/github/git-lfs/vendor/_nuts/github.com/spf13/cobra.(*Command).Execute(0xac4b20, 0x0, 0x0)
    C:/Users/techn/go/src/github.com/github/git-lfs/vendor/_nuts/github.com/spf13/cobra/command.go:551 +0x59a
github.com/github/git-lfs/commands.Run()
    C:/Users/techn/go/src/github.com/github/git-lfs/commands/commands.go:88 +0x2a
main.main()
    C:/Users/techn/go/src/github.com/github/git-lfs/git-lfs.go:34 +0x135
larsxschneider commented 9 years ago

I can confirm that, too. I swichted back to 1.0.0 and everything works again. Here is a complete log:

09:56:50.051438 git.c:348               trace: built-in: git 'clone' 'https://github-enterprise-server.com/schneil/lfs-test.git'
09:56:50.122520 run-command.c:338       trace: run_command: 'git-remote-https' 'origin' 'https://github-enterprise-server.com/schneil/lfs-test.git'
Cloning into 'lfs-test'...
09:56:50.557013 run-command.c:338       trace: run_command: 'git credential-wincred get'
* Couldn't find host github-enterprise-server.com in the _netrc file; using defaults
* timeout on name lookup is not supported
*   Trying 10.xxx.yyy.zzz...
* Connected to github-enterprise-server.com (10.xxx.yyy.zzz. port 443 (#0)
* ALPN, offering http/1.1
* Cipher selection: ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@STRENGTH
* successfully set certificate verify locations:
*   CAfile: C:/Program Files/Git/mingw64/ssl/certs/ca-bundle.crt
  CApath: none
* SSL connection using TLSv1.2 / ECDHE-RSA-AES128-GCM-SHA256
* ALPN, server accepted to use http/1.1
* Server certificate:
*    subject: jurisdictionC=US; jurisdictionST=Delaware; businessCategory=Private Organization; serialNumber=2401504; C=US; postalCode=94903; ST=California; L=San Rafael; street=111 McInnis Parkway; O=Autodesk, Inc.; OU=BRE; CN=github-enterprise-server.com
*    start date: 2015-06-05 00:00:00 GMT
*    expire date: 2016-06-29 23:59:59 GMT
*    subjectAltName: github-enterprise-server.com matched
*    issuer: C=US; O=Symantec Corporation; OU=Symantec Trust Network; CN=Symantec Class 3 EV SSL CA - G3
*    SSL certificate verify ok.
> GET /schneil/lfs-test.git/info/refs?service=git-upload-pack HTTP/1.1
Host: github-enterprise-server.com
User-Agent: git/2.6.2.windows.1
Accept: */*
Accept-Encoding: gzip
Accept-Language: en-US, *;q=0.9
Pragma: no-cache

< HTTP/1.1 401 Authorization Required
< Server: GitHub Babel 2.0
< Content-Type: text/plain
< WWW-Authenticate: Basic realm="GitHub"
< Connection: close
< 
* Closing connection 0
09:56:50.604749 git.c:560               trace: exec: 'git-credential-wincred' 'get'
09:56:50.604749 run-command.c:338       trace: run_command: 'git-credential-wincred' 'get'
09:56:51.152769 run-command.c:338       trace: run_command: 'git credential-wincred store'
* Couldn't find host github-enterprise-server.com in the _netrc file; using defaults
* timeout on name lookup is not supported
* Hostname github-enterprise-server.com was found in DNS cache
*   Trying 10.xxx.yyy.zzz...
* Connected to github-enterprise-server.com (10.xxx.yyy.zzz. port 443 (#1)
* ALPN, offering http/1.1
* Cipher selection: ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@STRENGTH
* successfully set certificate verify locations:
*   CAfile: C:/Program Files/Git/mingw64/ssl/certs/ca-bundle.crt
  CApath: none
* SSL re-using session ID
* SSL connection using TLSv1.2 / ECDHE-RSA-AES128-GCM-SHA256
* ALPN, server accepted to use http/1.1
* Server certificate:
*    subject: jurisdictionC=US; jurisdictionST=Delaware; businessCategory=Private Organization; serialNumber=2401504; C=US; postalCode=94903; ST=California; L=San Rafael; street=111 McInnis Parkway; O=Autodesk, Inc.; OU=BRE; CN=github-enterprise-server.com
*    start date: 2015-06-05 00:00:00 GMT
*    expire date: 2016-06-29 23:59:59 GMT
*    subjectAltName: github-enterprise-server.com matched
*    issuer: C=US; O=Symantec Corporation; OU=Symantec Trust Network; CN=Symantec Class 3 EV SSL CA - G3
*    SSL certificate verify ok.
> GET /schneil/lfs-test.git/info/refs?service=git-upload-pack HTTP/1.1
Host: github-enterprise-server.com
User-Agent: git/2.6.2.windows.1
Accept: */*
Accept-Encoding: gzip
Accept-Language: en-US, *;q=0.9
Pragma: no-cache

< HTTP/1.1 401 Authorization Required
< Server: GitHub Babel 2.0
< Content-Type: text/plain
< WWW-Authenticate: Basic realm="GitHub"
< Connection: close
< 
* Closing connection 1
* Issue another request to this URL: 'https://github-enterprise-server.com/schneil/lfs-test.git/info/refs?service=git-upload-pack'
* Couldn't find host github-enterprise-server.com in the _netrc file; using defaults
* NTLM-proxy picked AND auth done set, clear picked!
* timeout on name lookup is not supported
* Hostname github-enterprise-server.com was found in DNS cache
*   Trying 10.xxx.yyy.zzz...
* Connected to github-enterprise-server.com (10.xxx.yyy.zzz. port 443 (#2)
* ALPN, offering http/1.1
* Cipher selection: ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@STRENGTH
* successfully set certificate verify locations:
*   CAfile: C:/Program Files/Git/mingw64/ssl/certs/ca-bundle.crt
  CApath: none
* SSL re-using session ID
* SSL connection using TLSv1.2 / ECDHE-RSA-AES128-GCM-SHA256
* ALPN, server accepted to use http/1.1
* Server certificate:
*    subject: jurisdictionC=US; jurisdictionST=Delaware; businessCategory=Private Organization; serialNumber=2401504; C=US; postalCode=94903; ST=California; L=San Rafael; street=111 McInnis Parkway; O=Autodesk, Inc.; OU=BRE; CN=github-enterprise-server.com
*    start date: 2015-06-05 00:00:00 GMT
*    expire date: 2016-06-29 23:59:59 GMT
*    subjectAltName: github-enterprise-server.com matched
*    issuer: C=US; O=Symantec Corporation; OU=Symantec Trust Network; CN=Symantec Class 3 EV SSL CA - G3
*    SSL certificate verify ok.
* Server auth using Basic with user 'user-account'
> GET /schneil/lfs-test.git/info/refs?service=git-upload-pack HTTP/1.1
Host: github-enterprise-server.com
Authorization: Basic YXB0ZWthYTpMYWR5ODg2QCM=
User-Agent: git/2.6.2.windows.1
Accept: */*
Accept-Encoding: gzip
Accept-Language: en-US, *;q=0.9
Pragma: no-cache

< HTTP/1.1 200 OK
< Server: GitHub Babel 2.0
< Content-Type: application/x-git-upload-pack-advertisement
< Transfer-Encoding: chunked
< Expires: Fri, 01 Jan 1980 00:00:00 GMT
< Pragma: no-cache
< Cache-Control: no-cache, max-age=0, must-revalidate
< Vary: Accept-Encoding
< 
* Connection #2 to host github-enterprise-server.com left intact
09:56:51.199733 git.c:560               trace: exec: 'git-credential-wincred' 'store'
09:56:51.199733 run-command.c:338       trace: run_command: 'git-credential-wincred' 'store'
09:56:51.223618 run-command.c:338       trace: run_command: 'fetch-pack' '--stateless-rpc' '--stdin' '--lock-pack' '--thin' '--check-self-contained-and-connected' '--cloning' '--no-progress' 'https://github-enterprise-server.com/schneil/lfs-test.git/'
09:56:51.246648 git.c:348               trace: built-in: git 'fetch-pack' '--stateless-rpc' '--stdin' '--lock-pack' '--thin' '--check-self-contained-and-connected' '--cloning' '--no-progress' 'https://github-enterprise-server.com/schneil/lfs-test.git/'
09:56:51.419263 run-command.c:338       trace: run_command: 'unpack-objects' '-q' '--pack_header=2,27'
09:56:51.443291 git.c:348               trace: built-in: git 'unpack-objects' '-q' '--pack_header=2,27'
09:56:51.469353 run-command.c:338       trace: run_command: 'rev-list' '--objects' '--stdin' '--not' '--all'
09:56:51.492445 git.c:348               trace: built-in: git 'rev-list' '--objects' '--stdin' '--not' '--all'
* Couldn't find host github-enterprise-server.com in the _netrc file; using defaults
* Found bundle for host github-enterprise-server.com: 0x22518c0
* Re-using existing connection! (#2) with host github-enterprise-server.com
* Connected to github-enterprise-server.com (10.xxx.yyy.zzz. port 443 (#2)
* Server auth using Basic with user 'user-account'
> POST /schneil/lfs-test.git/git-upload-pack HTTP/1.1
Host: github-enterprise-server.com
Authorization: Basic YXB0ZWthYTpMYWR5ODg2QCM=
User-Agent: git/2.6.2.windows.1
Accept-Encoding: gzip
Content-Type: application/x-git-upload-pack-request
Accept: application/x-git-upload-pack-result
Content-Length: 412

* upload completely sent off: 412 out of 412 bytes
< HTTP/1.1 200 OK
< Server: GitHub Babel 2.0
< Content-Type: application/x-git-upload-pack-result
< Transfer-Encoding: chunked
< Expires: Fri, 01 Jan 1980 00:00:00 GMT
< Pragma: no-cache
< Cache-Control: no-cache, max-age=0, must-revalidate
< Vary: Accept-Encoding
< 
* Connection #2 to host github-enterprise-server.com left intact
09:56:51.512136 run-command.c:338       trace: run_command: 'git-lfs smudge '\''test.bin'\'''
trace git-lfs: run_command: 'git' config -l
trace git-lfs: run_command: 'git' config -l -f .git\config
Downloading test.bin (4 B)
trace git-lfs: api: batch 1 files
trace git-lfs: HTTP: POST https://github-enterprise-server.com/schneil/lfs-test.git/info/lfs/objects/batch
> POST /schneil/lfs-test.git/info/lfs/objects/batch HTTP/1.1
> Host: github-enterprise-server.com
> Accept: application/vnd.git-lfs+json; charset=utf-8
> Content-Type: application/vnd.git-lfs+json; charset=utf-8
> User-Agent: git-lfs/1.0.1 (GitHub; windows amd64; go 1.5.1; git 2182d86)
> 
{"objects":[{"oid":"47de97e16916cd2d895d58e6406cf39c7aec6f4b29a114d53f1d1d8a652c625b","size":0}],"operation":"download"}trace git-lfs: HTTP: 403
< HTTP/1.1 403 Forbidden
< Content-Length: 108
< Access-Control-Allow-Credentials: true
< Access-Control-Allow-Origin: *
< Access-Control-Expose-Headers: ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval
< Content-Security-Policy: default-src 'none'
< Content-Type: application/json; charset=utf-8
< Date: Wed, 28 Oct 2015 13:56:50 GMT
< Server: GitHub.com
< Status: 403 Forbidden
< Strict-Transport-Security: max-age=31536000; includeSubdomains; preload
< X-Content-Type-Options: nosniff
< X-Frame-Options: deny
< X-Github-Media-Type: unknown
< X-Github-Request-Id: 34479d91-2c5e-4480-b63f-ade47282f5f6
< X-Xss-Protection: 1; mode=block
< 
{"message":"Must authenticate to access this API.","documentation_url":"https://help.github.com/enterprise"}trace git-lfs: api error: Must authenticate to access this API.
Docs: https://help.github.com/enterprise
Error accessing media: test.bin (47de97e16916cd2d895d58e6406cf39c7aec6f4b29a114d53f1d1d8a652c625b)
trace git-lfs: run_command: 'git' version

Errors logged to .git\lfs\objects\logs\20151028T095651.9903979.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: test.bin: smudge filter lfs failed
warning: Clone succeeded, but checkout failed.
You can inspect what was checked out with 'git status'
and retry the checkout with 'git checkout -f HEAD'
strich commented 9 years ago

It actually looks like this issue exists in v1.0 too, however recent commits just made the error an explicit panic exit: https://github.com/github/git-lfs/commits/master/commands/command_smudge.go

If I look at my v1.0 lfs logs I can see plenty of the same Error accessing media: errors.

technoweenie commented 9 years ago

@strich:

Post objects/batch: unsupported protocol scheme ""

What does git lfs env say? It looks like you're not using an https or {user}@{server} ssh remote.

@larsxschneider This fixes your issue: https://github.com/github/git-lfs/pull/795. Found that right after the v1.0.1 release. I'll cut a new one today.

technoweenie commented 9 years ago

Git LFS v1.0.2 is out, which should fix your issue, @larsxschneider:

https://github.com/github/git-lfs/releases/tag/v1.0.2

Still working on getting the various linux and homebrew stuff shipped.

larsxschneider commented 9 years ago

@technoweenie Unfortunantly 1.0.2 still doesn't work for me. Do you see what is wrong?

lars@LARSSCHNEID7A47 MINGW64 ~/temp
$ git --version
git version 2.6.2.windows.1

lars@LARSSCHNEID7A47 MINGW64 ~/temp
$ git lfs version
git-lfs/1.0.2 (GitHub; windows amd64; go 1.5.1; git 0566698)

lars@LARSSCHNEID7A47 MINGW64 ~/temp
$ GIT_CURL_VERBOSE=1 GIT_TRACE=1 git clone https://github-enterprise.com/myuser/lfs-test.git clonetest
11:32:08.629000 git.c:348               trace: built-in: git 'clone' 'https://github-enterprise.com/myuser/lfs-test.git' 'clonetest'
Cloning into 'clonetest'...
11:32:08.654000 run-command.c:338       trace: run_command: 'git-remote-https' 'origin' 'https://github-enterprise.com/myuser/lfs-test.git'
* Couldn't find host github-enterprise.com in the _netrc file; using defaults
* timeout on name lookup is not supported
*   Trying 10.xxx.yyy.zzz...
* Connected to github-enterprise.com (10.xxx.yyy.zzz) port 443 (#0)
* ALPN, offering http/1.1
* Cipher selection: ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@STRENGTH
* successfully set certificate verify locations:
*   CAfile: C:/Program Files/Git/mingw64/ssl/certs/ca-bundle.crt
  CApath: none
* SSL connection using TLSv1.2 / ECDHE-RSA-AES128-GCM-SHA256
* ALPN, server accepted to use http/1.1
* Server certificate:
*        subject: jurisdictionC=US; jurisdictionST=Delaware; businessCategory=Private Organization; serialNumber=2401504; C=US; postalCode=94903; ST=California; L=San Rafael; street=111 McInnis Parkway; O=Autodesk, Inc.; OU=BRE; CN=github-enterprise.com
*        start date: Jun  5 00:00:00 2015 GMT
*        expire date: Jun 29 23:59:59 2016 GMT
*        subjectAltName: github-enterprise.com matched
*        issuer: C=US; O=Symantec Corporation; OU=Symantec Trust Network; CN=Symantec Class 3 EV SSL CA - G3
*        SSL certificate verify ok.
> GET /myuser/lfs-test.git/info/refs?service=git-upload-pack HTTP/1.1
Host: github-enterprise.com
User-Agent: git/2.6.2.windows.1
Accept: */*
Accept-Encoding: gzip
Accept-Language: en-US, *;q=0.9
Pragma: no-cache

< HTTP/1.1 401 Authorization Required
< Server: GitHub Babel 2.0
< Content-Type: text/plain
< WWW-Authenticate: Basic realm="GitHub"
< Connection: close
<
* Closing connection 0
11:32:09.910000 run-command.c:338       trace: run_command: 'C:/Program Files/Git/mingw64/libexec/git-core/git-gui--askpass' 'Username for '\''https://github-enterprise.com'\'': '
11:32:12.847000 run-command.c:338       trace: run_command: 'C:/Program Files/Git/mingw64/libexec/git-core/git-gui--askpass' 'Password for '\''https://myuser@github-enterprise.com'\'': '
* Couldn't find host github-enterprise.com in the _netrc file; using defaults
* timeout on name lookup is not supported
* Hostname github-enterprise.com was found in DNS cache
*   Trying 10.xxx.yyy.zzz...
* Connected to github-enterprise.com (10.xxx.yyy.zzz) port 443 (#1)
* ALPN, offering http/1.1
* Cipher selection: ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@STRENGTH
* successfully set certificate verify locations:
*   CAfile: C:/Program Files/Git/mingw64/ssl/certs/ca-bundle.crt
  CApath: none
* SSL re-using session ID
* SSL connection using TLSv1.2 / ECDHE-RSA-AES128-GCM-SHA256
* ALPN, server accepted to use http/1.1
* Server certificate:
*        subject: jurisdictionC=US; jurisdictionST=Delaware; businessCategory=Private Organization; serialNumber=2401504; C=US; postalCode=94903; ST=California; L=San Rafael; street=111 McInnis Parkway; O=Autodesk, Inc.; OU=BRE; CN=github-enterprise.com
*        start date: Jun  5 00:00:00 2015 GMT
*        expire date: Jun 29 23:59:59 2016 GMT
*        subjectAltName: github-enterprise.com matched
*        issuer: C=US; O=Symantec Corporation; OU=Symantec Trust Network; CN=Symantec Class 3 EV SSL CA - G3
*        SSL certificate verify ok.
> GET /myuser/lfs-test.git/info/refs?service=git-upload-pack HTTP/1.1
Host: github-enterprise.com
User-Agent: git/2.6.2.windows.1
Accept: */*
Accept-Encoding: gzip
Accept-Language: en-US, *;q=0.9
Pragma: no-cache

< HTTP/1.1 401 Authorization Required
< Server: GitHub Babel 2.0
< Content-Type: text/plain
< WWW-Authenticate: Basic realm="GitHub"
< Connection: close
<
* Closing connection 1
* Issue another request to this URL: 'https://github-enterprise.com/myuser/lfs-test.git/info/refs?service=git-upload-pack'
* Couldn't find host github-enterprise.com in the _netrc file; using defaults
* NTLM-proxy picked AND auth done set, clear picked!
* timeout on name lookup is not supported
* Hostname github-enterprise.com was found in DNS cache
*   Trying 10.xxx.yyy.zzz...
* Connected to github-enterprise.com (10.xxx.yyy.zzz) port 443 (#2)
* ALPN, offering http/1.1
* Cipher selection: ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@STRENGTH
* successfully set certificate verify locations:
*   CAfile: C:/Program Files/Git/mingw64/ssl/certs/ca-bundle.crt
  CApath: none
* SSL re-using session ID
* SSL connection using TLSv1.2 / ECDHE-RSA-AES128-GCM-SHA256
* ALPN, server accepted to use http/1.1
* Server certificate:
*        subject: jurisdictionC=US; jurisdictionST=Delaware; businessCategory=Private Organization; serialNumber=2401504; C=US; postalCode=94903; ST=California; L=San Rafael; street=111 McInnis Parkway; O=Autodesk, Inc.; OU=BRE; CN=github-enterprise.com
*        start date: Jun  5 00:00:00 2015 GMT
*        expire date: Jun 29 23:59:59 2016 GMT
*        subjectAltName: github-enterprise.com matched
*        issuer: C=US; O=Symantec Corporation; OU=Symantec Trust Network; CN=Symantec Class 3 EV SSL CA - G3
*        SSL certificate verify ok.
* Server auth using Basic with user 'myuser'
> GET /myuser/lfs-test.git/info/refs?service=git-upload-pack HTTP/1.1
Host: github-enterprise.com
Authorization: Basic xyz==
User-Agent: git/2.6.2.windows.1
Accept: */*
Accept-Encoding: gzip
Accept-Language: en-US, *;q=0.9
Pragma: no-cache

< HTTP/1.1 200 OK
< Server: GitHub Babel 2.0
< Content-Type: application/x-git-upload-pack-advertisement
< Transfer-Encoding: chunked
< Expires: Fri, 01 Jan 1980 00:00:00 GMT
< Pragma: no-cache
< Cache-Control: no-cache, max-age=0, must-revalidate
< Vary: Accept-Encoding
<
* Connection #2 to host github-enterprise.com left intact
11:32:18.565000 run-command.c:338       trace: run_command: 'fetch-pack' '--stateless-rpc' '--stdin' '--lock-pack' '--thin' '--check-self-contained-and-connected' '--cloning' 'https://github-enterprise.com/myuser/lfs-test.git/'
11:32:18.579000 git.c:348               trace: built-in: git 'fetch-pack' '--stateless-rpc' '--stdin' '--lock-pack' '--thin' '--check-self-contained-and-connected' '--cloning' 'https://github-enterprise.com/myuser/lfs-test.git/'
* Couldn't find host github-enterprise.com in the _netrc file; using defaults
* Found bundle for host github-enterprise.com: 0x2eff940
* Re-using existing connection! (#2) with host github-enterprise.com
* Connected to github-enterprise.com (10.xxx.yyy.zzz) port 443 (#2)
* Server auth using Basic with user 'myuser'
> POST /myuser/lfs-test.git/git-upload-pack HTTP/1.1
Host: github-enterprise.com
Authorization: Basic xyz==
User-Agent: git/2.6.2.windows.1
Accept-Encoding: gzip
Content-Type: application/x-git-upload-pack-request
Accept: application/x-git-upload-pack-result
Content-Length: 400

* upload completely sent off: 400 out of 400 bytes
< HTTP/1.1 200 OK
< Server: GitHub Babel 2.0
< Content-Type: application/x-git-upload-pack-result
< Transfer-Encoding: chunked
< Expires: Fri, 01 Jan 1980 00:00:00 GMT
< Pragma: no-cache
< Cache-Control: no-cache, max-age=0, must-revalidate
< Vary: Accept-Encoding
<
remote: Counting objects: 27, done.
remote: Compressing objects: 100% (2/2), done.
remote: Total11:32:18.896000 run-command.c:338       trace: run_command: 'unpack-objects' '--pack_header=2,27'
 27 (delta 4), reused 3 (delta 3), pack-reused 22
* Connection #2 to host github-enterprise.com left intact
11:32:18.913000 git.c:348               trace: built-in: git 'unpack-objects' '--pack_header=2,27'
Unpacking objects: 100% (27/27), done.
Checking connectivity... 11:32:18.947000 run-command.c:338       trace: run_command: 'rev-list' '--objects' '--stdin' '--not' '--all'
11:32:18.962000 git.c:348               trace: built-in: git 'rev-list' '--objects' '--stdin' '--not' '--all'
done.
11:32:18.999000 run-command.c:338       trace: run_command: 'git-lfs smudge '\''test.bin'\'''
trace git-lfs: run_command: 'git' config -l
trace git-lfs: run_command: 'git' config -l -f .git\config
Downloading test.bin (4 B)
trace git-lfs: api: batch 1 files
trace git-lfs: HTTP: POST https://github-enterprise.com/myuser/lfs-test.git/info/lfs/objects/batch
> POST /myuser/lfs-test.git/info/lfs/objects/batch HTTP/1.1
> Host: github-enterprise.com
> Accept: application/vnd.git-lfs+json; charset=utf-8
> Content-Type: application/vnd.git-lfs+json; charset=utf-8
> User-Agent: git-lfs/1.0.2 (GitHub; windows amd64; go 1.5.1; git 0566698)
>
{"objects":[{"oid":"47de97e16916cd2d895d58e6406cf39c7aec6f4b29a114d53f1d1d8a652c625b","size":4}],"operation":"download"}trace git-lfs: HTTP: 403
< HTTP/1.1 403 Forbidden
< Content-Length: 108
< Access-Control-Allow-Credentials: true
< Access-Control-Allow-Origin: *
< Access-Control-Expose-Headers: ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval
< Content-Security-Policy: default-src 'none'
< Content-Type: application/json; charset=utf-8
< Date: Fri, 30 Oct 2015 10:32:20 GMT
< Server: GitHub.com
< Status: 403 Forbidden
< Strict-Transport-Security: max-age=31536000; includeSubdomains; preload
< X-Content-Type-Options: nosniff
< X-Frame-Options: deny
< X-Github-Media-Type: unknown
< X-Github-Request-Id: 4e9c74e2-b177-490f-bcda-dd6a71508c70
< X-Xss-Protection: 1; mode=block
<
{"message":"Must authenticate to access this API.","documentation_url":"https://help.github.com/enterprise"}trace git-lfs: api error: Must authenticate to access this API.
Docs: https://help.github.com/enterprise
Error accessing media: test.bin (47de97e16916cd2d895d58e6406cf39c7aec6f4b29a114d53f1d1d8a652c625b)
trace git-lfs: run_command: 'git' version

Errors logged to .git\lfs\objects\logs\20151030T113220.21.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: test.bin: smudge filter lfs failed
warning: Clone succeeded, but checkout failed.
You can inspect what was checked out with 'git status'
and retry the checkout with 'git checkout -f HEAD'
technoweenie commented 9 years ago

HTTP/1.1 403 Forbidden Must authenticate to access this API.

That looks like a response from GitHub Enterprise's private mode setting. GitHub Enterprise 2.4 sends a 401 instead, which Git LFS interprets just fine.

If you run git lfs env, what is auth set to?

$ git lfs env
git-lfs/1.0.2 (GitHub; darwin amd64; go 1.5.1)
git version 2.3.8 (Apple Git-58)

Endpoint=https://github-enterprise.com/github/git-lfs-test.git/info/lfs (auth=basic)

If auth=none, then Git LFS will not send authentication by default. If the server responds with 401, it sets a git config value which changes the auth setting from none to basic. Now it should be sending auth on every request.

You can set this up yourself:

$ git config lfs.https://github-enterprise.com/github/git-lfs-test.git/info/lfs.access basic

It works best if you keep the git remote and git lfs endpoint all in lowercase (a real fix for this is intended for Git LFS v1.1 #755).

larsxschneider commented 8 years ago

@technoweenie sorry for the late reply. I was distracted with other issues. Your fix helps and this happens on all our machines with Windows 7. We indeed have GHE in private mode.

What can we do about it? Do we need to setup auth after every clone?

technoweenie commented 8 years ago

@larsxschneider Unfortunately you will have to do that until you're on GHE 2.4+. It made some major changes supporting the batch API that we couldn't backport to earlier GHE releases.

larsxschneider commented 8 years ago

OK! Thanks for letting me know! We are on 2.4.0. Is it fixed on 2.4.1 or do you mean 2.5.x?

technoweenie commented 8 years ago

It's definitely in the 2.4.0 tag. I'll have to spin an instance up and confirm.

technoweenie commented 8 years ago

Enterprise 2.4.0 returns 401 for me:

$ curl -H "Accept: application/vnd.git-lfs+json" -k \
  https://172.28.128.4/ghe-admin/effacious-rutabaga.git/info/lfs/objects/batch \
  -d '{"objects":[{"oid":"47de97e16916cd2d895d58e6406cf39c7aec6f4b29a114d53f1d1d8a652c625b","size":4}],"operation":"download"}' -i
HTTP/1.1 401 Unauthorized
Server: GitHub.com
Date: Tue, 17 Nov 2015 20:25:05 GMT
LFS-Authenticate: Basic realm="GitHub"

{
  "message": "Must authenticate to access this API.",
  "documentation_url": "https://help.github.com/enterprise"
}

This is the same request path from your example above:

> POST /myuser/lfs-test.git/info/lfs/objects/batch HTTP/1.1
> Host: github-enterprise.com
> Accept: application/vnd.git-lfs+json; charset=utf-8
> Content-Type: application/vnd.git-lfs+json; charset=utf-8
> User-Agent: git-lfs/1.0.2 (GitHub; windows amd64; go 1.5.1; git 0566698)
>
{"objects":[{"oid":"47de97e16916cd2d895d58e6406cf39c7aec6f4b29a114d53f1d1d8a652c625b","size":4}],"operation":"download"}trace git-lfs: HTTP: 403
< HTTP/1.1 403 Forbidden
larsxschneider commented 8 years ago

I should note that I only see that problem on Windows... not on OSX... this is weird because it should be a server problem, no?!

technoweenie commented 8 years ago

Yes, it should be returning 401 regardless of your OS.