How to block push to master branch on remote

前端 未结 3 1426
有刺的猬
有刺的猬 2021-02-07 11:36

Is there any way to block code push directly to master? I tried adding a script in .git/hooks/update:

#!/bin/sh
if [ $USER != \"git-repo-admin\" ];
         


        
3条回答
  •  刺人心
    刺人心 (楼主)
    2021-02-07 12:34

    You can go to repo settings -> Branches

    Git asks which branch you want to protect

提交回复
热议问题