gitエラー「refusing to update checked out branch」の回避法

「checked out branch」を「bare repo」に変換することによって「refusing to update checked out branch」などのエラーが出ないようにできる。

$ git push origin master
error: refusing to update checked out branch: refs/heads/master
error: By default, updating the current branch in a non-bare repository
error: is denied, because it will make the index and work tree inconsistent
error: with what you pushed, and will require 'git reset --hard' to match
error: the work tree to HEAD.
error: You can set 'receive.denyCurrentBranch' configuration variable to
error: 'ignore' or 'warn' in the remote repository to allow pushing into
error: its current branch; however, this is not recommended unless you
error: arranged to update its work tree to match what you pushed in some
error: other way.
error: To squelch this message and still keep the default behaviour, set
error: 'receive.denyCurrentBranch' configuration variable to 'refuse'.
! [remote rejected] master -> master (branch is currently checked out)
error: failed to push some refs to ''

checkoutされているrepoをbare repositoryにする

repo$ mv yoyodyne yoyodyne.outer
repo$ mv yoyodyne.outer/.git yoyodyne
repo$ rmdir yoyodyne.outer/
repo$ cd yoyodyne
repo$ git config --bool core.bare true

$ git push origin master
Counting objects: 63, done.
Compressing objects: 100% (41/41), done.
Writing objects: 100% (41/41), 4.39 KiB, done.
Total 41 (delta 27), reused 0 (delta 0)
8a52fb5..b5e05d8 master -> master