I want to create a server-side git hook to block direct push to remote main branch. I look through some blogs and find it can be done by creating a .git/hooks folder and put a script named "update" within that folder on remote repo(Refer to this link).
Firstly, I try to push local .git folder to remote repo. But even with command git add .git
and confirm .git is NOT in .gitignore file, it has not been push to remote repo with regular operations.
So my questions is how could I create .git folder in remote repo and put some scripts into .git/hooks subdirectory?