0

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?

taifwa
  • 302
  • 2
  • 10
  • For clarity I was expecting the `thing` repo to hold its git data in a `.git` dir like a normal cloned repo. – taifwa Aug 24 '17 at 12:57

1 Answers1

1

Hello can you please try to delete your 'thing' repo and reinit it with git init --bare thing.git. You don't need to run git config --bool core.bare true

leona
  • 423
  • 3
  • 16
  • The contents on the server become a literal .git content rather than a repo with checked out files and the git data in a .git directory.... none of the "duplicates" address the model i am attempting ... or is what i am doing an antipattern, and why? – taifwa Aug 24 '17 at 12:55