Prevent pushing to master on GitHub? Ask Question

Prevent pushing to master on GitHub? Ask Question

GitHub allows you to configure your repository so that users can't force push to master, but is there a way to prevent pushing to master entirely? I'm hoping to make it so that the only way of adding to commits to master is through the GitHub pull request UI.

ベストアンサー1

Since the original question / answer, Github has added a new option for this to the restricted branches UI which allows you to set this up.

マージ前にプル リクエストのレビューを要求する有効にすると、このルールに一致するブランチにマージする前に、すべてのコミットを保護されていないブランチに対して実行し、必要な数の承認レビューを含むプル リクエストを介して送信し、変更を要求しない必要があります。

これを見つけるには、[設定] > [ブランチ] > [ブランチ保護ルール] に移動して、[ルールの追加] をクリックします。指示に従った後のGithub UI次に、保護するブランチの名前を入力し、マージ前にプル リクエストのレビューを要求するチェックボックスをクリックします。クリックするボタンのある Github UIデフォルトでは、これによりモデレーター以外のユーザーのみが停止されます。また、モデレーターでもマージできないようにするための別のチェックボックスも下にあります。クリックする別のボタンを備えた Github UI

おすすめ記事