I'm having a hard time understanding this one ; pretty much all I've found via stack overflow and blogs seem to imply that using --bool core.bare true solves the issue but I believe there's something missing.
Example:
"cd $HOME"
git init thing
cd existingrepo
git remote add origin "$HOME/thing"
git push origin master
Doing this, I get an error ! [remote rejected] master -> master (branch is currently checked out)
I've found answers that basically say, go to thing/ and run
git config --bool core.bare true
When I do that, I can indeed push, but when I go to thing/ again, it's in a weird state - there are no files, and doing git-status I am told
fatal: This operation must be run in a work tree
so I reverse the bool operation
git config --bool core.bare true
git status
and I find that the changes are there, but there have also been delete stages
~/thing$ git status
On branch master
Changes to be committed:
  (use "git reset HEAD <file>..." to unstage)
        deleted:    .gitignore
        deleted:    registry.py
        deleted:    static/css/normalize.css
        deleted:    static/css/skeleton.css
I can only resolve this by performing a git reset --hard at which point my thing/ repository matches my original repository.
(I'm doing this with local folders, but the same behavious happens over SSH, which is my target workflow - basic SSH-based repos)
Can somebody enlighten me here please?
 
    