Git/Setting up a Server
< Git
A Git server is not supposed to host any uncommitted file, so its repositories should be initialized with "bare":
git init --bare /repositories/repo1
As files aren't hosted as flat copies, they are "uploaded" or "downloaded" with the help of dedicated git commands that take account of the necessary refactoring, checks and balances behind the scenes.
Most importantly, distributed repositories can then be initialized with git clone, updated with git pull, and submitted to the server with git push.
To prevent unauthorized users from erasing server-side branches when pushing, the branches can be locked, forcing the users to create pull requests with their changes to validate before merging.