
github からチェックアウトしようとすると、次のエラー メッセージが表示されました:
[user@arch ~]$ git clone --recursive https://github.com/simsong/tcpflow.git
Cloning into 'tcpflow'...
The authenticity of host 'github.com (192.30.253.113)' can't be established.
RSA key fingerprint is SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'github.com,192.30.253.113' (RSA) to the list of known hosts.
remote: Counting objects: 4190, done.
remote: Compressing objects: 100% (32/32), done.
remote: Total 4190 (delta 21), reused 29 (delta 12), pack-reused 4146
Receiving objects: 100% (4190/4190), 50.27 MiB | 2.21 MiB/s, done.
Resolving deltas: 100% (2954/2954), done.
Submodule 'src/be13_api' (https://github.com/simsong/be13_api.git) registered for path 'src/be13_api'
Submodule 'src/dfxml' (https://github.com/simsong/dfxml.git) registered for path 'src/dfxml'
Submodule 'src/http-parser' (https://github.com/nodejs/http-parser.git) registered for path 'src/http-parser'
Cloning into '/home/user/tcpflow/src/be13_api'...
remote: Counting objects: 1203, done.
remote: Compressing objects: 100% (8/8), done.
remote: Total 1203 (delta 2), reused 5 (delta 1), pack-reused 1194
Receiving objects: 100% (1203/1203), 477.47 KiB | 1.96 MiB/s, done.
Resolving deltas: 100% (821/821), done.
Cloning into '/home/user/tcpflow/src/dfxml'...
remote: Counting objects: 1929, done.
remote: Total 1929 (delta 0), reused 0 (delta 0), pack-reused 1929
Receiving objects: 100% (1929/1929), 572.09 KiB | 2.89 MiB/s, done.
Resolving deltas: 100% (1294/1294), done.
Cloning into '/home/user/tcpflow/src/http-parser'...
remote: Counting objects: 1487, done.
remote: Total 1487 (delta 0), reused 0 (delta 0), pack-reused 1487
Receiving objects: 100% (1487/1487), 667.24 KiB | 2.46 MiB/s, done.
Resolving deltas: 100% (916/916), done.
Submodule path 'src/be13_api': checked out 'c81521d768bb78499c069fcd7c47adc8eee0350c'
Submodule path 'src/dfxml': checked out 'c31224626cf5f6678d42cbcfbfcd4e6191c9a864'
error: Server does not allow request for unadvertised object 5bbcdc5df9d01b521e8da011bab0da70bdec3653
Fetched in submodule path 'src/http-parser', but it did not contain 5bbcdc5df9d01b521e8da011bab0da70bdec3653. Direct fetching of that commit failed.
[user@arch ~]$
私はこれらのリポジトリのメンテナーです。src/http-parser は別のリポジトリのフォークであり、そのリポジトリのメンテナーは、ファイルにいくつかの自動生成ファイルを追加するための私のプル リクエストを (理由も示さずに) 一貫して受け入れていません.gitignore
。しかし、それがここでの問題だとは思いません。
答え1
jgit - Git のアドバタイズされた参照とは何ですか? - Stack Overflow:
フェッチ中に、サーバーは、サーバーが保持している参照とクライアントがフェッチする可能性のある参照をリストできます。これらは、アドバタイズされた参照です。
- それは次のようになりますサーバーから特定のコミットを直接取得することはできません。取得できるのは参照 (ブランチやタグなど) のみです。あるいは、Github サーバーはそのようなリクエストを許可しないように設定されているということです。
それで、特定のコミットを取得したい場合は
--depth
<depth>-1
、フェッチされた参照から最大コミット離れている必要があります(サブモジュールのメタデータで指定されたブランチ/タグ)通常、
depth
リポジトリ内のコミットの合計数よりははるかに小さい、適度に大きい数値 ( または50
など) を設定することが推奨されます100
。たとえば、50
Travis はプロジェクトの初期クローンを作成するときに を使用します。
サブモジュールを で更新していない場合--depth
、コミットが見つからないということは、次のいずれかを意味します。
- サブモジュールのツリーが「浅い」状態にあり、上記が適用される(以前に更新された場合のみ可能、
--depth
またはの参入.gitmodules
はshallow = true
) - コミットはサブモジュールが使用しているブランチ上にありません
- コミットはサブモジュールのリポジトリにまったく存在しません。
- 誰かが間違いを犯したか、
- または、かつては存在していたが強制的に削除された
記録によると、あなたの特定のケースでは、最後のケースでした。コミットはリポジトリ5bbcdc5df9d01b521e8da011bab0da70bdec3653
にhttps://github.com/simsong/http-parser.git
まったく存在しません。
答え2
アドバタイズされていないオブジェクトにアクセスする方法の 1 つは、同期することです。その後、次のようにサブモジュールの更新が機能するはずです。
git submodule sync --recursive
git submodule update
答え3
これは、履歴の書き換えまたはスクワッシュによって削除されたサブモジュールコミットを指定している場合に発生する可能性があります。最善の方法は次のとおりです。
- まず、チームがこれまで何をしてきたかを明確に把握し、それがどのようになるべきかを把握します。
- git pull を使用してローカルを更新し、ブランチで機能する最も近いコミット (最新のものかもしれません) を見つけて、それを親リポジトリに追加します。たとえば、次のようになります。
parent-repo$ git fetch
parent-repo$ cd submodule-a
submodule-a$ git pull
submodule-a$ git checkout best-commit-according-to-team-and-your-branch
submodule-a$ cd ../
parent-repo$ git status
...
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
(commit or discard the untracked or modified content in submodules)
modified: submodule-a (modified content)
...
git add submodule-a
git commit -m "updated submodule-a reference"
それが正しいと確信し、チームが同意したら、それをプッシュアップするとエラーはなくなるはずです。
答え4
私の場合、これは、変更してコミットしたがプッシュバックしていないサブモジュールをプッシュバックせずに、親 Git リポジトリを Github にプッシュバックしたときに発生する傾向があります。