Git folder may be sel contained but doesn't always act like it.
For example, today I struggled trying to copy a recovered .git folder and files to a new Virtual Box system after a hard drive corruption of repo stored on external usb drive inside Virtual Box/Lubuntu got disconnected accidentally before proper shutdown (fixed with chkdsk /f /x) .
As far as I could tell, all files seemed intact, and git log appeared normal except headings were in red. But all attempts to push to the newly created remote repo were met with various errors such as "cannot traverse parent" for various commit #'s and "are you sure you have permission?" Also, there were some messages about "symlinks" when files were originally copied from my recovered drive to the
newly created VM. Ithought it might be a permissions issue but all files were read/write all. Maybe .git has internal checks? End result I only succeeded in push to remote by deleting .git and initializing the local repo (basically a hard reset)...all history lost (was only a class project so was local only beforehand, now Bitbucket will prevent recurrence I hope.
But I thought .git folder was self contained.