On 10/31/2017 02:56 AM, Timothy Rice wrote: >> It is possible to push to a NON checked out branch of a non-bare repo (that >> was apparently what they did in the old days before I knew Git). >> >> I use that method at work, so that I have a network share that is the >> non-bare 'remote', and I have a local drive repo that I'm working on. The >> network share looks like it has a checked out 'master' on it, but if you >> ('they') realise it has the hidden .git folder, then they could see that >> (using Git) it also has my working branch 'philip' on it! > > That is interesting to know. The first time I tried pushing to a non-bare > repo, the slap on the wrist conditioned me to never do it again, so I never > looked any deeper :)
Philip is correct. But still something is missed. Actually, you *can* push to a checkouted branch, provided that you have set the `receive.denyCurrentBranch` variable in the configuration file of the remote git repo. You should see remote output if you mistakenly try to push to a checkouted branch (in this case "master") of the remote git repo: 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 inconsistent remote: error: with what you pushed, and will require 'git reset --hard' to match 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'. So, have fun with git ;-) Yubin -- You received this message because you are subscribed to the Google Groups "Git for human beings" group. To unsubscribe from this group and stop receiving emails from it, send an email to git-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.