hub: Error creating pull request: Unprocessable Entity (HTTP 422)

I can’t open a pull request with hub. This is what I do:

$ git checkout -b new_branch
( some changes here)
$ git commit -m "Test commit"
$ git push origin new_branch
$ hub pull-request

And this is what I get from the last command:

(username and password lines)
Error creating pull request: Unprocessable Entity (HTTP 422)
field 'head_sha' is missing
field 'base_sha' is missing
base No commits between user:master and user:new_branch

About this issue

  • Original URL
  • State: closed
  • Created 12 years ago
  • Reactions: 3
  • Comments: 60 (18 by maintainers)

Commits related to this issue

Most upvoted comments

It seems it won’t accept the slash character (/) in branch name.

@ohcibi This is precisely what @lestephane is reporting here: we either have to fix the docs, or we shoud make hub work without the -u. But, I thought the latter already works. I will look deeper into this.

Thank you for the detailed reproduction steps! ❤️

Quick note: this happens very easily if one follows to the line the official instructions, because those suggest using:

# push the changes to your new remote
$ git push YOUR_USER feature

where as they should read:

# push the changes to your new remote
$ git push -u YOUR_USER feature

The -u flag is missing from the instructions. This has happened already to me three or four times, and I end up here every time. There may be other causes, but I suspect if the docs are updated with that trivial fix (add -u to that line), at least some people won’t stumble on this anymore…

got 422 error when the base and head branch where inverted…

I just realised I didn’t give any feedback.

I finally got my problem solved by doing hub pull-request -h <owner>:<current-branch>