I have seen a lot of people using git to deploy their websites to a non-bare repo and using
$ git config receive.denycurrentbranch ignore
this works fine as long as you don't really do any updates in the remote repo itself. It is really recommended not to work this way by pro git unless you realize what your doing as it really isn't how git is set up to work.
I like this method because it uses a
barerepo with a check out working tree, so that there is no .git folder in your working tree.
It's also good because you can make changes in the working tree, and also have multiple people working on the repo and git will function normally.
One thing to note is, if you want to make changes in the working tree of the remote repo you will have to either
-make a file in the root of your working tree called
with the contents.
Which is nice because you don't have to export
GIT_DIR every time
$ export GIT_DIR=path/to/your/repo.git
$ export GIT_WORK_TREE=path/to/your/workingtree
Every time you want to make changes in the working tree because a
bare repo technically isn't allowed to have a working tree.
If you use
core.worktree option to set the worktree it will fail and git will tell you
core.worktree dont make sense.
For some reason if you
git doesn't complain.
- @eviweb also has a great protip about how to configure
gitto play nicely if you want work in a
non-barerepo. here is the protip by @eviweb Using GIT to manage a website