【问题标题】:Artifactory not following git-lfs protocolArtifactory 不遵循 git-lfs 协议
【发布时间】:2020-04-07 19:10:42
【问题描述】:

我正在尝试提高 git-lfs 在 Artifactory 上的可靠性,我分析了客户端和 artifactory 之间的协议。
下载对象的第一部分是发送一个api命令。 {下载,[{objectID,大小},] 回复 [{OID,size, auth,action[]},{}] 问题是 action 是一个零长度数组,没有预期的“下载”信息。

我做了一个简单的 lfs 克隆的跟踪。我也改了名字来保护有罪的人。

问题是“_links”新协议使用“动作”

https://github.com/git-lfs/git-lfs/blob/master/docs/api/batch.md

"objects" : [ {
    "oid" : "8b4d08d6b3a211d6bb09f636ebdfcdc88ade2f20bd0c011954929b4a65aec07b",
    "size" : 189,
    "_links" : {
      "download" : {
        "href" : "https://server.org/artifactory/repo/objects/8b/4d/8b4d08d6b3a211d6bb09f636ebdfcdc88ade2f20bd0c011954929b4a65aec07b",
        "header" : {
          "Authorization" : "Basic c3lzX21pZ2NpbHg6QVA1NVhjRWExeWhBVGZVRUxoeEpHcGplVktY"
        }
      }
    }
  }

@@@@@@

 GIT_TRACE=1 GIT_CURL_VERBOSE=1 git lfs clone git@github.com:svsintel/testlfs.git
12:28:42.951804 git.c:576               trace: exec: git-lfs clone git@github.com:svsintel/testlfs.git
12:28:42.951860 run-command.c:646       trace: run_command: git-lfs clone git@github.com:svsintel/testlfs.git
12:28:42.957381 trace git-lfs: run_command: 'git' version
WARNING: 'git lfs clone' is deprecated and will not be updated
          with new flags from 'git clone'

'git clone' has been updated in upstream Git to have comparable
speeds to 'git lfs clone'.
Cloning into 'testlfs'...
X11 forwarding request failed on channel 0
remote: Enumerating objects: 9, done.
remote: Counting objects: 100% (9/9), done.
remote: Compressing objects: 100% (5/5), done.
remote: Total 9 (delta 0), reused 6 (delta 0), pack-reused 0
Receiving objects: 100% (9/9), done.
12:28:43.728998 trace git-lfs: run_command: 'git' config -l -f /home/savages/DEVEL/testlfs/.lfsconfig
12:28:43.730944 trace git-lfs: run_command: 'git' config -l
12:28:43.733209 trace git-lfs: run_command: '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
12:28:43.735365 trace git-lfs: run_command: '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
12:28:43.737654 trace git-lfs: tq: running as batched queue, batch size of 100
12:28:43.738479 trace git-lfs: run_command: git cat-file --batch
12:28:43.741076 trace git-lfs: fetch javaguidelink.png [8b4d08d6b3a211d6bb09f636ebdfcdc88ade2f20bd0c011954929b4a65aec07b]
12:28:43.741198 trace git-lfs: tq: sending batch of size 1
Git LFS: (0 of 1 files) 0 B / 189 B                                            12:28:43.741587 trace git-lfs: api: batch 1 files
12:28:43.741724 trace git-lfs: HTTP: POST https://server.org/repo/objects/batch
> POST /artifactory/api/lfs/repo/objects/batch HTTP/1.1
> Host: server.org
> Accept: application/vnd.git-lfs+json; charset=utf-8
> Content-Length: 122
> Content-Type: application/vnd.git-lfs+json; charset=utf-8
> User-Agent: git-lfs/2.3.4 (GitHub; linux amd64; go 1.8.3)
> 
{"operation":"download","objects":[{"oid":"8b4d08d6b3a211d6bb09f636ebdfcdc88ade2f20bd0c011954929b4a65aec07b","size":189}]}12:28:44.552717 trace git-lfs: HTTP: 401


< HTTP/1.1 401 Unauthorized
< Transfer-Encoding: chunked
< Content-Type: application/json
< Date: Tue, 17 Dec 2019 20:28:44 GMT
< Server: Artifactory/5.3.0
< Set-Cookie: BIGipServerlbauto-af01p-ir-https=!lwwF2ZPxFqh78i9ZXUYuw/jzKcOV9bdWzE0rDvzrv7YDwaHF/aePpE4m4YlV0HLmvlOn3f4in6Ea; path=/; Httponly; Secure
< Www-Authenticate: Basic realm="Artifactory Realm"
< X-Artifactory-Id: a4228f8f67d17308ce2e6929fb0d1c96b8fc4fc0
< X-Artifactory-Node-Id: irvapp049
< 
12:28:44.552948 trace git-lfs: HTTP: {
  "errors" : [ {
    "status" : 401,
    "message" : "Authorization Required"
  } ]
}
{
  "errors" : [ {
    "status" : 401,
    "message" : "Authorization Required"
  } ]
}12:28:44.553053 trace git-lfs: setting repository access to basic
12:28:44.553065 trace git-lfs: run_command: 'git' config --replace-all lfs.https://server.org/artifactory/api/lfs/repo.access basic
12:28:44.555768 trace git-lfs: api: http response indicates "basic" authentication. Resubmitting...
12:28:44.555852 trace git-lfs: creds: git credential fill ("https", "server.org", "artifactory/api/lfs/repo")
12:28:44.562949 trace git-lfs: Filled credentials for https://server.org/artifactory/api/lfs/repo
12:28:44.563100 trace git-lfs: HTTP: POST https://server.org/repo/objects/batch
> POST /artifactory/api/lfs/repo/objects/batch HTTP/1.1
> Host: server.org
> Accept: application/vnd.git-lfs+json; charset=utf-8
> Authorization: Basic * * * * *
> Content-Length: 122
> Content-Type: application/vnd.git-lfs+json; charset=utf-8
> User-Agent: git-lfs/2.3.4 (GitHub; linux amd64; go 1.8.3)
> 
{"operation":"download","objects":[{"oid":"8b4d08d6b3a211d6bb09f636ebdfcdc88ade2f20bd0c011954929b4a65aec07b","size":189}]}{"operation":"download","objects":[{"oid":"8b4d08d6b3a211d6bb09f636ebdfcdc88ade2f20bd0c011954929b4a65aec07b","size":189}]}12:28:46.318344 trace git-lfs: HTTP: 200


< HTTP/1.1 200 OK
< Transfer-Encoding: chunked
< Content-Type: application/vnd.git-lfs+json
< Date: Tue, 17 Dec 2019 20:28:46 GMT
< Server: Artifactory/5.3.0
< Set-Cookie: BIGipServerlbauto-af01p-ir-https=!PuMWH2edbtitYCJZXUYuw/jzKcOV9b83tgCkdCyENMF11Shn6y8h8GdLZf7RA08ntnJe+hDmFL6BoA==; path=/; Httponly; Secure
< X-Artifactory-Id: a4228f8f67d17308ce2e6929fb0d1c96b8fc4fc0
< X-Artifactory-Node-Id: irvapp032
< 
12:28:46.518402 trace git-lfs: HTTP: {
  "objects" : [ {
    "oid" : "8b4d08d6b3a211d6bb09f636ebdfcdc88ade2f20bd0c011954929b4a65aec07b",
    "size" : 189,
    "_links" : {
      "download" : {
        "href" : "https://server.org/repo/objects/8b/4d/8b4d08d6b3a211d6bb09f636ebdfcdc88ade2f20bd0c011954929b4a65aec07b",
        "header" : {
          "Authorization" : "Basic c3lzX21pZ2NpbHg6QVA1NVhjRWExeWhBVGZVRUxoeEpHcGplVktY"
        }
      }
    }
  } ]
}
{
  "objects" : [ {
    "oid" : "8b4d08d6b3a211d6bb09f636ebdfcdc88ade2f20bd0c011954929b4a65aec07b",
    "size" : 189,
    "_links" : {
      "download" : {
        "href" : "https://server.org/repo/objects/8b/4d/8b4d08d6b3a211d6bb09f636ebdfcdc88ade2f20bd0c011954929b4a65aec07b",
        "header" : {
          "Authorization" : "Basic c3lzX21pZ2NpbHg6QVA1NVhjRWExeWhBVGZVRUxoeEpHcGplVktY"
        }
      }
    }
  } ]
}12:28:46.518635 trace git-lfs: tq: starting transfer adapter "basic"
Git LFS: (0 of 1 files) 0 B / 189 B                                            12:28:46.519344 trace git-lfs: HTTP: GET https://server.org/artifactory/repo/objects/8b/4d/8b4d08d6b3a211d6bb09f636ebdfcdc88ade2f20bd0c011954929b4a65aec07b
> GET /artifactory/repo/objects/8b/4d/8b4d08d6b3a211d6bb09f636ebdfcdc88ade2f20bd0c011954929b4a65aec07b HTTP/1.1
> Host: server.org
> Authorization: Basic * * * * *
> User-Agent: git-lfs/2.3.4 (GitHub; linux amd64; go 1.8.3)
> 
Git LFS: (0 of 1 files) 0 B / 189 B                                            12:28:47.326791 trace git-lfs: HTTP: 200

< HTTP/1.1 200 OK
< Content-Length: 189
< Accept-Ranges: bytes
< Content-Disposition: attachment; filename="8b4d08d6b3a211d6bb09f636ebdfcdc88ade2f20bd0c011954929b4a65aec07b"; filename*=UTF-8''8b4d08d6b3a211d6bb09f636ebdfcdc88ade2f20bd0c011954929b4a65aec07b
< Content-Type: application/octet-stream
< Date: Tue, 17 Dec 2019 20:28:47 GMT
< Etag: b0b31c0cbccf04819012d82385f3966ba0856d18
< Last-Modified: Fri, 02 Aug 2019 09:42:37 GMT
< Server: Artifactory/5.3.0
< Set-Cookie: BIGipServerlbauto-af01p-ir-https=!kfSG8soGK6fsAIdZXUYuw/jzKcOV9czEPoAj80t8OIgyLdw5+B9YrT0o6uFWA5Jp3HDyK32k00JB; path=/; Httponly; Secure
< X-Artifactory-Filename: 8b4d08d6b3a211d6bb09f636ebdfcdc88ade2f20bd0c011954929b4a65aec07b
< X-Artifactory-Id: a4228f8f67d17308ce2e6929fb0d1c96b8fc4fc0
< X-Artifactory-Node-Id: irvapp049
< X-Checksum-Md5: b36c320fa2845b3c75f95685474843c9
< X-Checksum-Sha1: b0b31c0cbccf04819012d82385f3966ba0856d18
< 
Git LFS: (1 of 1 files) 189 B / 189 B                                          
12:28:47.556210 trace git-lfs: Install hook: pre-push, force=false, path=/home/savages/DEVEL/testlfs/.git/hooks/pre-push, upgrading...
12:28:47.556810 trace git-lfs: Install hook: post-checkout, force=false, path=/home/savages/DEVEL/testlfs/.git/hooks/post-checkout, upgrading...
12:28:47.557303 trace git-lfs: Install hook: post-commit, force=false, path=/home/savages/DEVEL/testlfs/.git/hooks/post-commit, upgrading...
12:28:47.558058 trace git-lfs: Install hook: post-merge, force=false, path=/home/savages/DEVEL/testlfs/.git/hooks/post-merge, upgrading...

【问题讨论】:

  • 我发现它正在使用已弃用的协议。它正在使用“_links:{...}”
  • 请添加更多详细信息。您还可以向 JFrog Artifactory Jira 提出错误/改进请求。 jfrog.com/jira

标签: protocols artifactory git-lfs


【解决方案1】:

Artifactory 3.9 及以上版本支持 gitLFS 协议。

https://www.jfrog.com/confluence/display/JFROG/Git+LFS+Repositories

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-07-26
    • 1970-01-01
    相关资源
    最近更新 更多