1

Codeship pulls a clone with a depth of 50 to speed up the build process. We had a pull request that was over 50 commits (uncommon but happens) and our deployment to catalyze failed with the following error:

 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'

After squashing a few commits we were able to deploy but we ran into an issue when we had a rather large PR that needed to be merged. To avoid the error

 ' ! [remote rejected] dev -> master (shallow update not allowed) '

We added the following script to our deployment pipeline and everything worked fine.

 if [ -f ${HOME}/clone/.git/shallow ]; then git fetch --unshallow; fi
arenfroe
  • 23
  • 7

1 Answers1

1

We added the following script to our deployment pipeline and everything worked fine.

if [ -f ${HOME}/clone/.git/shallow ]; then git fetch --unshallow; fi

arenfroe
  • 23
  • 7
  • The above command will only fetch the full history of the repository if it is a shallow clone. Codeship recommends to add this directly before the deployment (e.g. via a script based deployment) so it doesn't fetch all revisions when you only run your tests. The integrated deployments automatically unshallow the repository if the deployment is based on doing a `git push` – mlocher Jul 30 '16 at 09:30
  • We are running a script based deployment so we had to add this. We had not run into this problem before and a google search returned completely different answers. Because codeship makes a shallow clone to speed up the build process it is only an issue on pr's over 50 commits. I just wanted to throw this out there for whoever may need it. Thank you though. – arenfroe Aug 02 '16 at 21:04