Codeship 拉取深度为 50 的克隆以加快构建过程。我们有一个超过 50 次提交的拉取请求(不常见但会发生),我们的催化部署失败并出现以下错误:
Warning: Permanently added '<deployment host>
to the list of known hosts.
Counting objects: 6551, done.
Delta compression using up to 32 threads.
Compressing objects: 100% (2626/2626), done.
Writing objects: 100% (6551/6551), 23.57 MiB | 16.37 MiB/s, done.
Total 6551 (delta 3843), reused 6551 (delta 3843)
To <>.git
! [remote rejected] dev -> master (shallow update not allowed)
error: failed to push some refs to '<>.git'
在压缩了一些提交之后,我们能够部署,但是当我们有一个相当大的 PR 需要合并时,我们遇到了一个问题。为了避免错误
' ! [remote rejected] dev -> master (shallow update not allowed) '
我们将以下脚本添加到我们的部署管道中,一切正常。
if [ -f ${HOME}/clone/.git/shallow ]; then git fetch --unshallow; fi