title: Why I get the errors when the `git push origin master` command is working?
body: <p>I am learning git. I use the <a href="http://git-for-windows.github.io/" rel="nofollow">Git for Windows</a>.
  Why I get the errors when the <code>git push origin master</code> command is working?</p>
  
  <p>I have written the script (BAT-file) for showing of this problem:</p>
  
  <pre><code>:: script.bat
  ::======================
  :: Git repositories host
  set host=d:/sandbox
  :: Virtual disk name
  set disk=v:
  
  subst %disk% %host%
  cd /D %disk%/
  
  :: create some "remote" repository
  set origin=v:\server
  mkdir %origin%
  
  set git="C:\Program Files\Git\bin\git.exe"
  
  call %git% init %origin%
  echo aaa &gt; "%origin%/a.txt"
  echo bbb &gt; "%origin%/b.txt"
  echo ccc &gt; "%origin%/c.txt"
  
  cd %origin%
  call %git% add "*"
  call %git% commit -m "Initialized"
  
  :: clone our "remote" repository
  set client1=%disk%\client-1
  
  call %git% clone "%origin%" "%client1%"
  
  cd "%client1%"
  call %git% remote -v
  
  echo ddd &gt; "%client1%/d.txt"
  call %git% add "./d.txt"
  call %git% commit -m "./d.txt file added"
  call %git% status
  
  :: here is the problem...
  call %git% push origin master
  
  subst /D %disk%
  </code></pre>
  
  <p>I get such output:</p>
  
  <pre><code>C:\Users\bushm&gt;D:\sandbox\script.bat
  
  C:\Users\bushm&gt;set host=d:/sandbox
  
  C:\Users\bushm&gt;set disk=v:
  
  C:\Users\bushm&gt;subst v: d:/sandbox
  
  C:\Users\bushm&gt;cd /D v:/
  
  v:\&gt;set origin=v:\server
  
  v:\&gt;mkdir v:\server
  
  v:\&gt;set git="C:\Program Files\Git\bin\git.exe"
  
  v:\&gt;call "C:\Program Files\Git\bin\git.exe" init v:\server
  Initialized empty Git repository in v:/server/.git/
  
  v:\&gt;echo aaa  1&gt;"v:\server/a.txt"
  
  v:\&gt;echo bbb  1&gt;"v:\server/b.txt"
  
  v:\&gt;echo ccc  1&gt;"v:\server/c.txt"
  
  v:\&gt;cd v:\server
  
  v:\server&gt;call "C:\Program Files\Git\bin\git.exe" add "*"
  
  v:\server&gt;call "C:\Program Files\Git\bin\git.exe" commit -m "Initialized"
  [master (root-commit) 49f7952] Initialized
   3 files changed, 3 insertions(+)
   create mode 100644 a.txt
   create mode 100644 b.txt
   create mode 100644 c.txt
  
  v:\server&gt;set client1=v:\client-1
  
  v:\server&gt;cd "v:\"
  
  v:\&gt;call "C:\Program Files\Git\bin\git.exe" clone "v:\server" "v:\client-1"
  Cloning into 'v:\client-1'...
  done.
  
  v:\&gt;cd "v:\client-1"
  
  v:\client-1&gt;call "C:\Program Files\Git\bin\git.exe" remote -v
  origin  v:\server (fetch)
  origin  v:\server (push)
  
  v:\client-1&gt;echo ddd  1&gt;"v:\client-1/d.txt"
  
  v:\client-1&gt;call "C:\Program Files\Git\bin\git.exe" add "./d.txt"
  
  v:\client-1&gt;call "C:\Program Files\Git\bin\git.exe" commit -m "./d.txt file adde
  d"
  [master b6a43f1] ./d.txt file added
   1 file changed, 1 insertion(+)
   create mode 100644 d.txt
  
  v:\client-1&gt;call "C:\Program Files\Git\bin\git.exe" status
  On branch master
  Your branch is ahead of 'origin/master' by 1 commit.
    (use "git push" to publish your local commits)
  nothing to commit, working directory clean
  
  v:\client-1&gt;call "C:\Program Files\Git\bin\git.exe" push origin master
  Counting objects: 3, done.
  Delta compression using up to 4 threads.
  Compressing objects: 100% (2/2), done.
  Writing objects: 100% (3/3), 278 bytes | 0 bytes/s, done.
  Total 3 (delta 1), reused 0 (delta 0)
  remote: error: refusing to update checked out branch: refs/heads/master
  remote: error: By default, updating the current branch in a non-bare repository
  remote: error: is denied, because it will make the index and work tree inconsist
  ent
  remote: error: with what you pushed, and will require 'git reset --hard' to matc
  h
  remote: error: the work tree to HEAD.
  remote: error:
  remote: error: You can set 'receive.denyCurrentBranch' configuration variable to
  
  remote: error: 'ignore' or 'warn' in the remote repository to allow pushing into
  
  remote: error: its current branch; however, this is not recommended unless you
  remote: error: arranged to update its work tree to match what you pushed in some
  
  remote: error: other way.
  remote: error:
  remote: error: To squelch this message and still keep the default behaviour, set
  
  remote: error: 'receive.denyCurrentBranch' configuration variable to 'refuse'.
  To v:\server
   ! [remote rejected] master -&gt; master (branch is currently checked out)
  error: failed to push some refs to 'v:\server'
  
  v:\client-1&gt;subst /D v:
  
  v:\client-1&gt;
  </code></pre>
  
  <p>Why I get these errors?</p>