Skip to content

'Remote branch HEAD not found in upstream origin' error on build #6087

Closed
@buty4649

Description

@buty4649

I am building mruby with specified mgems. After performing rake deep_clean and trying to build it again, I encounter a 'Remote branch HEAD not found in upstream origin' error, and the build fails.

From what I've investigated, it seems that the issue is caused by the branch name written in build_config.rb.lock changing from master to HEAD.

Reproduction Steps

I have placed the code to reproduce the issue on https://github.com/buty4649/mruby-remote-branch-bug. Please use this for reference.

  1. Clone the repository from https://github.com/buty4649/mruby-remote-branch-bug and move to that directory.
    $ git clone https://github.com/buty4649/mruby-remote-branch-bug
    $ cd mruby-remote-branch-bug
  2. At this point, it is set to branch: master.
    $ grep branch build_config.rb.lock
      branch: HEAD
  3. Proceed with the build.
    $ MRUBY_CONFIG=$(pwd)/build_config.rb MRUBY_BUILD_DIR=$(pwd)/build rake -f /path/to/mruby/Rakefile
  4. After the build completes, it changes to branch: HEAD.
    $ git diff | cat
    diff --git a/build_config.rb.lock b/build_config.rb.lock
    index db02184..642f97b 100644
    --- a/build_config.rb.lock
    +++ b/build_config.rb.lock
    @@ -7,6 +7,6 @@ builds:
       host:
         https://github.com/mattn/mruby-json.git:
           url: https://github.com/mattn/mruby-json.git
    -      branch: master
    +      branch: HEAD
           commit: f99d9428025469f2400f93c53b185f65f963e507
       version: 0.0.0
  5. Cleanup build directory.
    $ MRUBY_CONFIG=$(pwd)/build_config.rb MRUBY_BUILD_DIR=$(pwd)/build rake -f /path/to/mruby/Rakefile deep_clean
  6. Try building again, and the issue should reproduce.
    $ MRUBY_CONFIG=$(pwd)/build_config.rb MRUBY_BUILD_DIR=$(pwd)/build rake -f /path/to/mruby/Rakefile
    -- snip --
    fatal: Remote branch HEAD not found in upstream origin
    rake aborted!
    Command failed with status (128): [git clone --recursive --branch "HEAD" "htt...]
    -- snip ---

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions