1. 管理員身份登錄GitHub,找到項目
2. Settings-->Branches-->Protected branches--->Choose a branch... ,選擇需要保護的分支,然后點擊edit按鈕,
3. Branch protection for 所選的分支名 --> 勾選Restrict who can push to this branch People and teams with push access
若不選擇任何人,則任何人都沒有push代碼到該分支的權限。