0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

【GitHub】ブランチ直接プッシュ禁止の設定

Last updated at Posted at 2025-06-05

はじめに

開発のメインブランチやリリース用のブランチにに対して直接のプッシュを禁止して、プルリクを出さないと変更を反映できないようにできます。
誤操作やレビューなしの変更は危険であり、チーム開発する際の安全性を高められます。

これにより
・指定されたリモートブランチへのプッシュが拒否される
・プルリク経由でのレビュー・テストフローが徹底できる

手順

1. リポジトリ設定ページの表示

  • GitHubで対象リポジトリを開く
  • 上部メニューから Settings をクリック
  • 左メニューの Branches を選択

2. ブランチ保護ルールの追加

  • Branch protection rules内の Add rule または Create rule をクリック
  • Branch name patternに保護対象のブランチ名を入力
    スクリーンショット 2025-06-05 233602.png

3. プッシュ禁止の設定

  • Require a pull request before mergingにチェック
  • Block force pushesにチェック
  • ページ下部の Create または Save changes をクリック
    スクリーンショット 2025-06-06 093320.png

補足

「Require a pull request before merging」内項目(オプション)は下記の記事で。
【GitHub】プルリクのルール設定

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?