{"thread":{"id":"37584","subject":"git fetch specific ref fails when run against a remote where HEAD points to missing master branch","startedAt":"2014-09-17T17:40:04Z","lastAt":"2014-09-17T17:40:04Z","messageCount":1,"participants":["Keller, Jacob E"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"249601","messageId":"1410975603.23945.4.camel@jekeller-desk1.amr.corp.intel.com","threadId":"37584","inReplyTo":null,"subject":"git fetch specific ref fails when run against a remote where HEAD points to missing master branch","fromName":"Keller, Jacob E","fromEmail":"jacob.e.keller@intel.com","sentAt":"2014-09-17T17:40:04Z","receivedAt":"2014-09-17T17:40:04Z","isPatch":false,"sender":{"key":"jacob.e.keller@intel.com","avatar":"https://avatars.githubusercontent.com/u/874719?v=4"},"body":"Hi,\n\nI am assuming this is simply a configuration issue on my end for this\nparticular remote, because I never pushed to the master branch, and so\nthe HEAD of this remote doesn't exist.\n\nHowever, I am also using it to fetch specific refs I know the name of,\nso it confuses me when I try to fetch and get back a failure, because\nthe remote HEAD ref doesn't exist...\n\nCommand \"git fetch --tags --progress git://gitlad.jf.intel.com/git/jekeller/testing/ixgbe +refs/heads/*:refs/remotes/origin/*\" returned status code 1:\nstdout: Fetching submodule src/COMPAT\n\nstderr: remote: Counting objects: 9, done.        \nremote: Compressing objects:  33% (1/3)           \nremote: Compressing objects:  66% (2/3)           \nremote: Compressing objects: 100% (3/3)           \nremote: Compressing objects: 100% (3/3), done.        \nremote: Total 3 (delta 1), reused 0 (delta 0)        \nFrom git://gitlad.jf.intel.com/git/jekeller/testing/ixgbe\n * [new branch]      2014-09-17-b6c6ff2c76ae -> origin/2014-09-17-b6c6ff2c76ae\nfatal: Couldn't find remote ref HEAD\n\nSo in order to understand what I am doing:\n\nI have a continuous integration build, which I can pre-test a series of\ncommits before pushing it to the real remote, by pushing to a ref in\nthis repository, and then indicating to my continuous build server to\ntest against that ref.\n\nAs it turns out, my remote didn't have a master branch, (as I never\npushed anything there!), and so even though it was a bare repository,\nHEAD was pointing still to refs/heads/master\n\nI fixed this issue by adding a master branch that was empty. I also\nassume I could have updated HEAD to point to a different location if I\nwanted also.. but I'm not sure this should be an error in the case that\nI fetch a specific ref by command line parameter? Especially as it\nmanages to fetch all the refs I asked for correctly, but still fails\nwith a non-zero exit value.\n\nRegards,\nJake\n"}]}