状況
複数人が高頻度で変更をプッシュするブランチ(仮にbranch1
とする)をsteps.checkout
を使ってcheckoutしようとしていた。
問題のYaml
resources:
repositories:
- repository: MyRepo
type: github
endpoint: someendpoint
name: myorg/myrepo
ref: branch1
steps:
- checkout: MyRepo
このパイプラインを実行すると、以下のようなエラーが表示された😢
git checkout --progress --force 4808c4a0862a2c20ed832dbd1c8b2
fatal: reference is not a tree: 4808c4a0862a2c20ed832dbd1c8b2
##[warning]Git checkout failed on shallow repository, this might because of git fetch with depth '1' doesn't include the checkout commit '4808c4a0862a2c20ed832dbd1c8b2'. Please reference documentation (http://go.microsoft.com/fwlink/?LinkId=829603)
##[error]Git checkout failed with exit code: 128
解決方法
steps.checkout
にfetchDepth: 0
を指定する。
steps:
- checkout: MyRepo
fetchDepth: 0