git: fatal: Couldn't find remote ref HEAD

Asked by Francis ANDRE

I am building a package using git SCM and got an fatal error with the below recipe.
What I am missing?

Git version:
git version 2.7.4
git-build-recipe 0.3.4~git201611291343.dcee459~ubuntu16.04.1
Building recipe:
# git-build-recipe format 0.4 deb-version {debupstream}-1~{revtime}
lp:~zosrothko/poco/+git/kampbell-develop develop
nest-part debian lp:~zosrothko/poco/+git/distro Linux/Ubuntu/poco/2.0.0/debian debian branch:2.0.0

RUN ['git-build-recipe', '--safe', '--no-build', '--manifest', '/home/buildd/build-RECIPEBRANCHBUILD-1343506/chroot-autobuild/home/buildd/work/tree/manifest', '--distribution', 'yakkety', '--allow-fallback-to-native', '--append-version', '~ubuntu16.10.1', '/home/buildd/build-RECIPEBRANCHBUILD-1343506/chroot-autobuild/home/buildd/work/recipe', '/home/buildd/build-RECIPEBRANCHBUILD-1343506/chroot-autobuild/home/buildd/work/tree']
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/gitbuildrecipe/", line 308, in pull_or_clone
  File "/usr/lib/python3/dist-packages/gitbuildrecipe/", line 336, in fetch_branches
    "refs/heads/*:refs/remotes/%s/*" % child_branch.remote_name)
  File "/usr/lib/python3/dist-packages/gitbuildrecipe/", line 652, in git_call
  File "/usr/lib/python3.5/", line 626, in check_output
  File "/usr/lib/python3.5/", line 708, in run
    output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['git', '-C', '/home/buildd/build-RECIPEBRANCHBUILD-1343506/chroot-autobuild/home/buildd/work/tree/recipe', 'fetch', 'lp:~zosrothko/poco/+git/kampbell-develop', 'HEAD:refs/remotes/source/HEAD', 'refs/heads/*:refs/remotes/source/*']' returned non-zero exit status 128

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/bin/git-build-recipe", line 9, in <module>
    load_entry_point('git-build-recipe==0.1', 'console_scripts', 'git-build-recipe')()
  File "/usr/lib/python3/dist-packages/gitbuildrecipe/", line 110, in main
    build_tree(base_branch, working_directory)
  File "/usr/lib/python3/dist-packages/gitbuildrecipe/", line 479, in build_tree
    _build_inner_tree(base_branch, target_path)
  File "/usr/lib/python3/dist-packages/gitbuildrecipe/", line 400, in _build_inner_tree
    pull_or_clone(base_branch, target_path)
  File "/usr/lib/python3/dist-packages/gitbuildrecipe/", line 310, in pull_or_clone
    raise FetchFailed(e.output)
gitbuildrecipe.recipe.FetchFailed: git fetch failed:
fatal: Couldn't find remote ref HEAD

Question information

English Edit question
Launchpad itself Edit question
No assignee Edit question
Solved by:
Colin Watson
Last query:
Last reply:
Revision history for this message
Best Colin Watson (cjwatson) said :

The "Couldn't find remote ref HEAD" error is a bit mysterious and I can't reproduce that locally. It's possible that that was some kind of temporary problem with the import that went away when the importer next ran.

There is one thing definitely wrong with your recipe, though: you need to write "2.0.0" rather than "branch:2.0.0". When I make that change locally, git-build-recipe succeeds, so you should try making that change to and request new builds.

Revision history for this message
Francis ANDRE (zosrothko) said :

Thanks for your dagnostic. It works.

Revision history for this message
Francis ANDRE (zosrothko) said :

Thanks Colin Watson, that solved my question.