Skip to content

Cannot change default branch #24523

Discussion options

You must be logged in to vote

Hey all, I got the answer to this! I got enough people to look and eventually someone spotted a word I missed in the docs on every read-through: “Required”, up at the top of the repo edit section, on the “name” field.

So, the correct command (including the repo name) is:

hub api repos/rm-you/test_branch_change_api -X PATCH -F name="test_branch_change_api" -F default_branch="new_branch"

Or:

curl -s -H "Authorization: token $GITHUB_TOKEN" https://github.com/api/v3/repos/rm-you/test_branch_change_api -X PATCH --data '{"name": "test_branch_change_api", "default_branch": "new_branch"}'

I don’t totally understand why the repo name is required here, since it is already *necessarily* in the URL…

Replies: 14 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
7 participants