Skip to content

brad-projects/projects

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Introduction

The main parent projects repo.

Construct file

Change main branch requiring pr

gh api -X PUT \
  -H "Accept: application/vnd.github+json" \
  repos/brad-projects/projects/branches/main/protection \
  --input protection.json

Add a new branch protection

Exactly — this error happens because you just enabled branch protection requiring pull requests. Once that rule is active, you cannot push directly to main; all changes must go through a pull request.

Here’s what to do next:

  1. Create a new branch locally:
git checkout -b protection-policy
  1. Commit your changes to the new branch (you already did, so just make sure the branch has the commit):
git log --oneline

You should see your "Add protection policy" commit on protection-policy.

  1. Push the branch to GitHub:
git push -u origin protection-policy
  1. Create a pull request:

You can do it via the CLI:

gh pr create --base main --head protection-policy --title "Add protection policy" --body "Add branch protection JSON file"

Or via the GitHub web interface.

  1. Merge the PR once approved — this is now the only way to update main because of the branch protection rule.

If you want, I can show a shortcut one-liner to push and immediately open a PR using gh so you don’t need multiple commands. Do you want that?

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages