Changing a branch caused git to "refs/heads/ refs/tags/' exited with code 128 saying: fatal missing object"

Symptoms

The following symptoms appears when editing or changing a branch/tag

Error
'C:\Program Files (x86)\Git\bin\git.exe for-each-ref --sort=-objecttype --format=%(objecttype)%02%(refname)%02%(refname:short)%02%(objectname)%02%(*objectname) refs/heads/ refs/tags/' exited with code 128 saying: fatal: missing object 0000000000000000000000000000000000000000 for refs/heads/8ad682bdd88a2c8318bc3a03e28a3479/Microsoft.Build.Framework.ni.dll

Cause

The error occurs because the file in .git/refs/[head|tag]/<file> exists in Stash's filesystem but the remote ref is broken. 

(info) [heads|tag] could refer to either a branch or a tag

Resolution

To resolve this issue you need to do the following:

  1. Identify the repository ID for the affected branch by accessing the settings on that repository and look under "Location On Disk". The number at the end of the path refers to the ID of the repository we are interested in:



  2. Navigate to Stash's repository with that ID, this can be found at <Stash_Home>/shared/data/repositories/<repository-ID>
  3. Continue navigating though the directory refs/[heads|tag]/<name> where the error complains about the missing object
  4. Check for the presence of the file the error was referring to. ((warning) As an example from the above error, the file that we are interested is Microsoft.Build.Framework.ni.dll)
  5. Remove that file 
    (warning) Note that by removing this file, you will be removing that branch/tag from Stash. You can recreate the branch/tag again by pushing local content back to Stash
  6. (info) If present, locate the same line ( refs/[heads|tag]/<name> ) in the file /data/repositories/<repository-id>/packed-refs and remove only that line.
  7. Restart Stash instance

 

Last modified on Mar 30, 2016

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.