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
- display more validation errors on HTTP 422 references #269, #189 — committed to mislav/hub by mislav 12 years ago
- Be smarter about pull requests This avoids errors like github/hub#189: Error creating pull request: Unprocessable Entity (HTTP 422) Invalid value for "head" — committed to vermiculus/magithub by vermiculus 8 years ago
- [pull-request] Test `push.default=upstream` + no upstream config https://github.com/github/hub/issues/189#issuecomment-507639770 — committed to mislav/hub by mislav 5 years ago
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:
where as they should read:
The
-uflag 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-uto 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>