{"id":430,"date":"2012-07-30T17:46:14","date_gmt":"2012-07-30T21:46:14","guid":{"rendered":"http:\/\/www.peteonsoftware.com\/?p=430"},"modified":"2012-07-30T17:57:47","modified_gmt":"2012-07-30T21:57:47","slug":"git-error-does-not-point-to-a-valid-object","status":"publish","type":"post","link":"https:\/\/www.peteonsoftware.com\/index.php\/2012\/07\/30\/git-error-does-not-point-to-a-valid-object\/","title":{"rendered":"Git Error : (does not point to a valid object)"},"content":{"rendered":"<p>A friend of mine IMed me the other day to ask if I had ever seen an error like the one below:<\/p>\n<pre>\r\nerror: unable to find e291a84831b445ba982539cc63a418126f0b5364\r\nerror: refs\/heads\/master does not point to a valid object!\r\nfatal: Couldn't find remote ref master\r\nfatal: The remote end hung up unexpectedly\r\n<\/pre>\n<p>I had not, but it seemed plain enough.  It appeared that the head of the master branch was pointing to a commit that didn&#8217;t actually exist in the repository.  I don&#8217;t know for sure how this happened, but my friend&#8217;s team suspected a disrupted internet connection on push as one theory.<\/p>\n<p>I Googled the error and found suggestions like &#8220;make a new remote&#8221; and &#8220;clone to a new branch, push, delete master, rename new branch&#8221;.  This seemed like just too much work.  There had to be an easier solution.  <\/p>\n<p>I was unable to clone the remote to my own machine (I got that same error on trying) and the team was in another state, so &#8211; short of a screensharing session &#8211; I couldn&#8217;t easily work with them on the problem.<\/p>\n<p>I had the developer who had done the last known valid commit before this error send me the most recent 5 items output from the &#8220;git log&#8221; command and got the following (edited for privacy):<\/p>\n<pre>\r\ncommit b65f24a64e78b38d193aa545d7b184fe26330a4c\r\nAuthor: Joe Developer &lt;joed@somewhere.com&gt;\r\nDate:   Fri Jul 27 10:05:53 2012 -0400\r\n\r\n    Moved foo.jar to libs folder\r\n\r\ncommit 32b15424509881760667a77b615cc91e8e31afb9\r\nAuthor: Joe Developer &lt;joed@somewhere.com&gt;\r\nDate:   Thu Jul 26 21:45:46 2012 -0400\r\n\r\n    Load swf files\r\n\r\ncommit bfac8d86c20ebbcac22af4e599e5815b0586f3d0\r\nAuthor: Joe Developer &lt;joed@somewhere.com&gt;\r\nDate:   Thu Jul 26 19:18:25 2012 -0400\r\n\r\n    Navigation bug fixes\r\n\r\ncommit 60c5ff87435861157e56d948e09c63ad2f4db520\r\nAuthor: Jane Developer &lt;janed@somewhere.com&gt;\r\nDate:   Thu Jul 26 15:52:36 2012 -0400\r\n\r\n    post merge\r\n\r\ncommit 1a97d137a51c6cd34825e4c9bc705620dfff7712\r\nAuthor: Jane Developer &lt;janed@somewhere.com&gt;\r\nDate:   Thu Jul 26 15:24:40 2012 -0400\r\n\r\n    initial commit\r\n<\/pre>\n<p>Because Git is based in the file system, I could literally navigate to the remote file system and go to the ProjectName.git folder and into the refs\/heads\/ folder and find the master file (no extension).  Inside was one string, the offending e291a84831b445ba982539cc63a418126f0b5364.  I just replaced that string with the hash of the latest valid commit &#8211; b65f24a64e78b38d193aa545d7b184fe26330a4c &#8211; and then saved.<\/p>\n<p>After that, I could clone the repo and the developers could pull, merge, and push their own changes.  They were using DropBox in this instance as a &#8220;poor man&#8217;s remote&#8221; and upon further reflection, I have to wonder if that is what caused the conflict.  Perhaps there was a problem with DropBox syncing all of the files and maybe a race condition at some point that resulted in a corruption?  I know DropBox isn&#8217;t a perfect &#8220;remote server&#8221; solution, but a lot of people use it for certain circumstances, so this might be something to look out for.<\/p>\n<p>If anyone else has seen this error and has a better fix than the one described here, then please leave a comment and let me know.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>A friend of mine IMed me the other day to ask if I had ever seen an error like the one below: error: unable to find e291a84831b445ba982539cc63a418126f0b5364 error: refs\/heads\/master does not point to a valid &hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[15,33,55],"tags":[89,100,115],"class_list":["post-430","post","type-post","status-publish","format-standard","hentry","category-code-tips","category-errors","category-git","tag-code-tips","tag-errors","tag-git"],"_links":{"self":[{"href":"https:\/\/www.peteonsoftware.com\/index.php\/wp-json\/wp\/v2\/posts\/430","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.peteonsoftware.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.peteonsoftware.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.peteonsoftware.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.peteonsoftware.com\/index.php\/wp-json\/wp\/v2\/comments?post=430"}],"version-history":[{"count":0,"href":"https:\/\/www.peteonsoftware.com\/index.php\/wp-json\/wp\/v2\/posts\/430\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.peteonsoftware.com\/index.php\/wp-json\/wp\/v2\/media?parent=430"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.peteonsoftware.com\/index.php\/wp-json\/wp\/v2\/categories?post=430"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.peteonsoftware.com\/index.php\/wp-json\/wp\/v2\/tags?post=430"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}