Suppose I do this.
Using github
- on local machine: - git init testrepo
- on github: make a repo test.git pressing buttons in the web interface 
- on local: 
cd testrepo
git remote add origin https://github.com/Someuser/test.git
and then:
touch somefile
git add .
git commit -m 'first'
git push -u origin master
Everything is fine and I have my somefile syncronized to github repo.
Using a remote server
- on local machine: - git init testrepo
- on remote machine: 
git init test.git*
- on local:
cd testrepo
git remote add origin remotemachine:~/test.git
and then:
touch somefile
git add .
git commit -m 'first'
git push -u origin master
Oh, no!..
Error message.
! [remote rejected] master -> master (branch is currently checked out)
Everything looks the same. Why does github act differently?
Optionally, what is the remedy? Optionally - because you'll see a bunch of proposed solutions in the below question but none of them is accepted answer.
I am aware of this question Git push error '[remote rejected] master -> master (branch is currently checked out)'
However it doesn't answer my question.
*After getting my question answered I have understood that git init test.git is a bad practice going reverse to conventions. Because it creates a folder with a .git folder inside of it. This .git folder IS a repo. And what is INSIDE a newly created folder APART from .git IS A WORKING SPACE.
git init test.git --bare is ok, however, because this command creates a test.git folder (a bare repo) corresponding to what would be inside a .git folder mentioned above.
 
    