cariad
October 30, 2021, 1:43pm
1
Hi!
I have a Hugo blog at GitHub - cariad/unbuild.blog: https://unbuild.blog and a Netlify site to publish it at Netlify App
Up until today, I’ve been able to create pull requests in my blog and have Netlify generate a preview. For example: Add "dinject 1.0.4" by cariad · Pull Request #6 · cariad/unbuild.blog · GitHub
Today, I created a new pull request (Differently 1.0.0 by cariad · Pull Request #7 · cariad/unbuild.blog · GitHub ) and Netlify can’t preview it:
2:39:49 PM: Preparing Git Reference pull/7/head
2:39:50 PM: Error fetching branch: https://github.com/cariad/unbuild.blog pull/7/head
2:39:50 PM: Creating deploy upload records
2:39:50 PM: Failing build: Failed to prepare repo
2:39:50 PM: Failed during stage 'preparing repo': exit status 1
However, if I manually clear the cache and retry the same build, it works. The build history is here: Netlify App
I can’t see what I’m doing wrong. Can anybody give me a hand?
Thanks!
Hi @cariad ,
The problem is with the Git submodules that you’re using. This is the error we get in our logs:
fatal: remote error: upload-pack: not our ref 050feef06793d1ea675ba99d95c81c5f99bbe5e5
Errors during submodule fetch: themes/tofu-hugo
This is the description of the error: github - Why does git submodule update fail with "fatal: remote error: upload-pack: not our ref"? - Stack Overflow
cariad
October 30, 2021, 1:59pm
4
Thanks @hrishikesh ! I’ll look into that now. Do you know why Netlify would be able to pull the submodule when I deploy manually and fail only via the GitHub preview?
cariad:
when I deploy manually
Deploy manually? When you deploy manually, Netlify doesn’t pull your repo or build anything.
cariad
October 30, 2021, 2:03pm
6
When I say “manual”, I mean I log into Netflify and click the “clear cache and deploy” button, as opposed to “the preview deploys automatically when I create a pull request.”
Oh, that would be because Netlify cleares the repo and the submodule from cache and fetches it as new. This is what’s executed:
git clone project
cd project
git submodule update -f --init
and this is what’s executed in a cached build:
cd project
git fetch -f -u remote ref
git checkout -f FETCH_HEAD
git submodule update -f --init
If Git throws error in this command, it fails.
cariad
October 30, 2021, 2:11pm
8
Right, thanks! So what I don’t understand it, why does the submodule fail to update when running from a cache?
The submodule’s commit exists. The retry would fail if the commit didn’t exist, right? The retry doesn’t change anything in the repository.
cariad
October 31, 2021, 10:02am
9
The problem seems to have fixed itself for new pull requests this morning.
I still don’t understand how I could’ve broken the Git submodule as you claim.
1 Like
hillary
November 1, 2021, 4:41pm
10
Hi @cariad
Thanks so much for coming back and confirming that the issue is resolved. Should this issue pop up again in the future, please let us know.
Happy building