git/list[1] front-page[2] threads[3] people[4] search[5] about
 

git fetch specific ref fails when run against a remote where HEAD points to missing master branch

From
Keller, Jacob E <jacob.e.keller@intel.com>
Date
Sep 17, 2014, 17:40 UTC
Message-ID
<1410975603.23945.4.camel@jekeller-desk1.amr.corp.intel.com>
Hi,

I am assuming this is simply a configuration issue on my end for this particular remote, because I never pushed to the master branch, and so the HEAD of this remote doesn't exist.

However, I am also using it to fetch specific refs I know the name of, so it confuses me when I try to fetch and get back a failure, because the remote HEAD ref doesn't exist...

Command "git fetch --tags --progress git://gitlad.jf.intel.com/git/jekeller/testing/ixgbe +refs/heads/*:refs/remotes/origin/*" returned status code 1: stdout: Fetching submodule src/COMPAT

stderr: remote: Counting objects: 9, done.        
remote: Compressing objects:  33% (1/3)           
remote: Compressing objects:  66% (2/3)           
remote: Compressing objects: 100% (3/3)           
remote: Compressing objects: 100% (3/3), done.        
remote: Total 3 (delta 1), reused 0 (delta 0)        
From git://gitlad.jf.intel.com/git/jekeller/testing/ixgbe
 * [new branch]      2014-09-17-b6c6ff2c76ae -> origin/2014-09-17-b6c6ff2c76ae
fatal: Couldn't find remote ref HEAD
So in order to understand what I am doing:

I have a continuous integration build, which I can pre-test a series of commits before pushing it to the real remote, by pushing to a ref in this repository, and then indicating to my continuous build server to test against that ref.

As it turns out, my remote didn't have a master branch, (as I never pushed anything there!), and so even though it was a bare repository, HEAD was pointing still to refs/heads/master

I fixed this issue by adding a master branch that was empty. I also assume I could have updated HEAD to point to a different location if I wanted also.. but I'm not sure this should be an error in the case that I fetch a specific ref by command line parameter? Especially as it manages to fetch all the refs I asked for correctly, but still fails with a non-zero exit value.

Regards, Jake

Message 1 of 1 in “git fetch specific ref fails when run against a remote where HEAD points to missing master branch”
  1. Keller, Jacob ESep 17, 2014

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.