# Git shallow clone followed by checkout -cf $hash fails my build

**URL:** <https://travis-ci.community/t/git-shallow-clone-followed-by-checkout-cf-hash-fails-my-build/772>\
**Category:** Environments\
**Tags:** github-integration\
**Created:** [November 7, 2018, 11:31pm UTC](https://travis-ci.community/t/git-shallow-clone-followed-by-checkout-cf-hash-fails-my-build/772 "2018-11-07T23:31:16Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![fiorix](https://avatars.discourse-cdn.com/v4/letter/f/b2d939/32.png) [@fiorix](https://travis-ci.community/u/fiorix)\
**Post date:** [November 7, 2018, 11:31pm UTC](https://travis-ci.community/t/git-shallow-clone-followed-by-checkout-cf-hash-fails-my-build/772/1 "2018-11-07T23:31:16Z")

</div>

What happened here: I made some changes to my GitHub repo and pushed it. Minutes after, I went back and updated the README and pushed again.

Then I’ve got this error on my build:

[https://travis-ci.org/fiorix/jsonschema2go/jobs/452139839#L55](https://travis-ci.org/fiorix/jsonschema2go/jobs/452139839#L55)

I believe what’s happening is that the shallow clone, depth=1, only has my latest (head) commit bcd91 and not the previous, dd7488, which is the changeset being tested.

The subsequent build for bcd91 worked just fine, as expected: [https://travis-ci.org/fiorix/jsonschema2go/builds/452142874](https://travis-ci.org/fiorix/jsonschema2go/builds/452142874)

There may be some intermittent issue where people push too fast and their tests fail.

---

<div class="post-metadata">

**Author:** ![BanzaiMan](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/banzaiman/32/67_2.png) [@BanzaiMan](https://travis-ci.community/u/BanzaiMan)\
**Post date:** [November 8, 2018, 2:58am UTC](https://travis-ci.community/t/git-shallow-clone-followed-by-checkout-cf-hash-fails-my-build/772/2 "2018-11-08T02:58:03Z")

</div>

This is explained in [our document](https://docs.travis-ci.com/user/customizing-the-build#git-clone-depth). You should really define a value higher than 1 for the depth.
