-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error creating pull request: Unprocessable Entity (HTTP 422) #189
Comments
Well, the error message says: "No commits between user:master and user:new_branch". That means you probably need to indicate the base for the pull request explicitly. What are your remotes setup, and do you want to send the pull request for "origin/master" or some other remote? |
I just tried too and without specifying i got this error as well. Here's what I used to merge a topic branch into master and convert the issue (3) into a pull request (which I must say is really handy!):
Lullabot (in this example) is the name of the GitHub organization, so if this were one of my own personal repos, I would replace 'Lullabot' with 'sirkitree' (I think). |
@sirkitree thanks for confirming this point. I did not update the issue because right after opening it I found my hub version was updated, and I thought it might have been solved... I'll take a look at the issue again this week, @mislav (I'm sorry, I'm really busy right now, exams at university) |
OK. I'll close this right now since it's most probably a problem with your workflow, not a bug in hub. The error is a validation error from GitHub. Tips for working with pull-request:
|
I'm getting this too. I've verified that there are commits between the branches in question. I've been using |
It would be great if one of you actually provided me all the details needed to debug this, i.e. remotes config, branches in question, upstream config for those branches. Bonus points if it's an opensource project |
I added a dummy commit (arbitrary whitespace change) to my head branch then it worked. Definitely a bug in Github. A few days ago I was having a similar issue. A commit was not showing up on the commits index on github.com (https://github.com/balexand/private_project_name/commits/master). I was able to verify that the commit had in fact been pushed to |
@mislav I posted my last comment before I saw your response. If I see this issue again then I'll give you details before I push a new commit. Thanks! Are you a githubber (and thus have access to debug this on the server-side)? |
I worked at GH last year but not anymore. And even if I had access to server side, I would still need details |
The problem I had was that when I pushed my branch remotely I did not set it to track with So, if you do this: But if you do this: |
Yes, setting up upstream configuration helps hub with determining what to open a pull request for. Otherwise, in some situations you need to explicitly set head and base via command-line flags. I'm closing this since it seems none of you hit an actual bug in hub, but that you didn't use explicit base/head flags when you needed to. If you are strongly convinced that hub does something wrong in certain scenarios, please fill me in with more details. |
I’m currently having the same issue. $ hub pull-request "Make generator scripts output data in the new format" -b "slevithan:master" -h "mathiasbynens:astral-support" -i 29
Error creating pull request: Unprocessable Entity (HTTP 422) I have used Relevant links:
Am I doing something wrong? I’ve used this exact same command successfully before. |
Is that the full error message? You can only turn your own issues into pull requests; this is GitHub's limitation. This way you can't hijack other people's issues. |
Ah, that explains it. Last time I used it, it was an issue that I had created. Thanks!
That’s the full error message, yes. Does GitHub provide more details in case of such an error? If so, it would be useful to have |
hub should display that message. Make sure you have the latest version of hub. |
Isn’t v1.10.1 the most recent version? $ hub --version
git version 1.7.10.4
hub version 1.10.1 An empty line shows up below the “Error creating pull request: Unprocessable Entity (HTTP 422)” message. I guess that’s where the details would be if GitHub provided them, then? |
@mathiasbynens 1.10.2 is now… Did y'all ever get this figured out? |
@mathiasbynens Seems like you tried to provide both subject line and issue number when opening a pull request. You can't do that (although that's probably not the cause of your problems) The cause of your problem is likely that you don't own the issue in question. You can turn an issue to pull request if you don't own it yourself, or have admin right on the repo (I guess?) I'll try to make better error messages, but I already tried to display the errors GitHub returns. Maybe they are simply not returning enough details in this case. |
Ran into the same issue just yet. Found an issue in a project, forked it, hacked up a fix proposal, wanted to add it to the issue. No dice. |
@ackalker See my comment. Your problem stems from the fact that you don't own the issue in question. I'll try to make the error message clearer about this. |
I just realised I didn't give any feedback. I finally got my problem solved by doing |
I had the same problem as described at the very top of this thread, even when I specified the base and head explicitely. In my case, the problem was that it was trying to create a pull request based off my local branch, rather than the remote branch, even though it had been pushed. i.e. The Fix: paying close attention and specifing the remote username of the branch I was trying to create a pull request from: I'm sure there is a config not set quite right somewhere for me, but Im glad it works and hopefully this will help someone. |
I have the same issue running latest homebrew hub and xcode git:
Here's an example, although this happens for all my repos I've tested so far on this machine. I have these remotes:
I make a branch, push to my repo, and make a pull request - always with same error:
Here's the new (matthew-brett:hub-test-branch) and the previous (nipy:master) commits: 02ca3ea10361658859711c3a19567321c46122d3 Add a new file for testing |
My issue fixed by updating to hub version 1.12 |
@matthew-brett I am experiencing similar issues with hub and getting HTTP 422 error when I make a pull-request to a remote repo. How did you upgrade hub to 1.12? I am using brew and it keeps complaining that there is none available. My git version is 1.9.0 and hub version is 1.11.2. |
I just did |
@jerryasher Sorry you're having trouble!
Sorry that this is such a mess right now. I'm working on making this easier. In the meantime, you can try using explicit head:
|
Thanks, I won't be able to get back to this until Thursday, but I On Sep 20, 2016 4:02 PM, "Mislav Marohnić" notifications@github.com wrote:
|
Okay, so getting back, and reading about about push.default, I do sort of think at least one issue is that my git config push.default is So
git config push.default is And hub fails with:
The same validation error occurs even when I point to an explicit head. Googling for hub authentication issues, I can't see anything I am doing/did wrong. I did login a few days back with hub. I do see a ~/.config/hub that seems to have a valid token for user: jerryasher and on github itself there is a token that is described as "hub for Jerry@mybox" that has enabled scopes: repo, repo:status, repo_deployment, public_repo |
Thanks for that debugging data. The parameters that hub tries to POST as a new pull request is perfectly valid. You are not able to create a pull request because, as it turns out, |
Well that's an interesting statement! I admit I am a novice with git and github, but if I recall the pedigree of jerryasher/pelican, I cloned it from getpelican/pelican onto my local machine, setup the remotes, and then pushed onto github. I think that's what I did, but well I'm not sure. Is that not a fork? Are you saying it's "merely" a clone, not a fork, and if so, what were you able to look at that let you know it was a clone (or whatever it is) and not a fork? |
Heh. Okay, I bet amongst other things you were looking for this: |
Sorry, I didn't know you were new to GitHub. A "fork" can mean two things, depending on the context:
|
I had this error too. |
It seems it won't accept the slash character (/) in branch name. |
git version 2.13.1 I get the same error. |
yes, still the same error. |
Anyone who is still getting the
Thank you. |
@mislav I just had this because I forgot to push to my fork before
|
Does this still work, I tried all variations, all I can get is:
|
In my case, it was a simple mistake of not pushing the local branch to the remote origin. |
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 |
@fperez Good catch. Mind submitting a fix for the gh-pages branch? |
Why was this closed? @fperez pointed out that the official instructions miss the crucial parameter ( # push the changes to your new remote
$ git push origin feature I followed those instructions for the first time today, and, sure enough, got the 422, and landed on this issue... |
@lestephane Are you using the latest version of hub? This should work: $ git push origin HEAD
$ hub pull-request If it doesn't, then please state some more info, such as git remote configuration and current |
This is what I have
My main concern is whether I can follow the instructions at https://hub.github.com without getting any error. For my next PR I'll follow the instructions to the letter, and report more details if I still get the problem. Do you see any problem with my current versions and git config? |
@lestephane I'm sorry, but you'll have to share more info about your error. Hub does work (this is verified by automated tests) that What I want to know is:
Thank you! |
Here is the full reproduction showing that the instructions on https://hub.github.com/ for contributing "As a contributor to open-source" are not working for me. After the reproduction, I answer each of your questions in turn. the HUB_VERBOSE=1 output can be confusing with lines starting with dollar sign ($) which could be mistaken for commands I ran myself as part of the reproduction, so I put the verbose output at the very, very end of this comment. Reproduction$ hub --version
git version 2.21.0
hub version 2.12.1
$ grep "hub alias" ~/.bashrc
eval "$(hub alias -s)"
$ git clone --depth 1 github/hub
Cloning into 'hub'...
remote: Enumerating objects: 676, done.
remote: Counting objects: 100% (676/676), done.
remote: Compressing objects: 100% (538/538), done.
remote: Total 676 (delta 162), reused 345 (delta 101), pack-reused 0
Receiving objects: 100% (676/676), 1.42 MiB | 635.00 KiB/s, done.
Resolving deltas: 100% (162/162), done.
$ git checkout -b feature
Switched to a new branch 'feature'
$ echo -e "\nnew stuff" >> README.md
$ git commit -am "done with feature"
[feature a08a79d] done with feature
1 file changed, 2 insertions(+)
$ git fork --remote-name=origin
renaming existing "origin" remote to "upstream"
Updating origin
remote: Enumerating objects: 17667, done.
remote: Counting objects: 100% (17667/17667), done.
remote: Compressing objects: 100% (5670/5670), done.
remote: Total 17352 (delta 11605), reused 17010 (delta 11266), pack-reused 0
Receiving objects: 100% (17352/17352), 4.80 MiB | 641.00 KiB/s, done.
Resolving deltas: 100% (11605/11605), completed with 238 local objects.
From git://github.com/github/hub
* [new branch] 1.11-stable -> origin/1.11-stable
* [new branch] 1.12-stable -> origin/1.12-stable
* [new branch] 2.2-stable -> origin/2.2-stable
* [new branch] 2.7-stable -> origin/2.7-stable
...(full branch and tag listing here)
* [new tag] v2.8.0 -> v2.8.0
* [new tag] v2.8.1 -> v2.8.1
* [new tag] v2.8.2 -> v2.8.2
* [new tag] v2.8.3 -> v2.8.3
* [new tag] v2.8.4 -> v2.8.4
* [new tag] v2.9.0 -> v2.9.0
new remote: origin
$ git push origin feature
Enumerating objects: 22, done.
Counting objects: 100% (21/21), done.
Delta compression using up to 8 threads
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 300 bytes | 100.00 KiB/s, done.
Total 3 (delta 2), reused 0 (delta 0)
remote: Resolving deltas: 100% (2/2), completed with 2 local objects.
remote:
remote: Create a pull request for 'feature' on GitHub by visiting:
remote: https://github.com/lestephane/hub/pull/new/feature
remote:
To github.com:lestephane/hub.git
* [new branch] feature -> feature
$ git pull-request
(edit the description in vim , then :wq)
Error creating pull request: Unprocessable Entity (HTTP 422)
Invalid value for "head"
$ git config -l | grep -v user.name | sort
alias.changes=log --name-status HEAD..
alias.up=pull --rebase --autostash
branch.master.merge=refs/heads/master
branch.master.remote=upstream
color.ui=auto
core.autocrlf=input
core.bare=false
core.editor=vim
core.excludesfile=/home/lestephane/.gitignore_global
core.filemode=true
core.logallrefupdates=true
core.repositoryformatversion=0
core.whitespace=cr-at-eol
credential.helper=/usr/share/doc/git/contrib/credential/gnome-keyring/git-credential-gnome-keyring
diff.tool=meld
http.postbuffer=52428800
merge.conflictstyle=diff3
merge.tool=meld
mergetool.meld.path=/usr/bin/meld
push.default=upstream
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
remote.origin.url=git@github.com:lestephane/hub.git
remote.upstream.fetch=+refs/heads/master:refs/remotes/upstream/master
remote.upstream.url=git://github.com/github/hub.git
user.useconfigonly=true
$ git remote -vv
origin git@github.com:lestephane/hub.git (fetch)
origin git@github.com:lestephane/hub.git (push)
upstream git://github.com/github/hub.git (fetch)
upstream git://github.com/github/hub.git (push) Answers to your questions
The way it is described at https://hub.github.com/ for contributing "As a contributor to open-source", through the git alias $ git push origin feature
Included in the reproduction, restated here for convenience $ git remote -vv
origin git@github.com:lestephane/hub.git (fetch)
origin git@github.com:lestephane/hub.git (push)
upstream git://github.com/github/hub.git (fetch)
upstream git://github.com/github/hub.git (push)
Yes, since I'm following the way it is described at https://hub.github.com/ for contributing "As a contributor to open-source", which says I should do $ git fork --remote-name=origin` Which I did (see reproduction)
The output of
|
@Lestaphane you have to track your feature branch. It’s not a bug but a common error users do because of missing documentation.
Instead of simply git push |
@ohcibi This is precisely what @lestephane is reporting here: we either have to fix the docs, or we shoud make hub work without the Thank you for the detailed reproduction steps! ❤️ |
I can't open a pull request with hub. This is what I do:
And this is what I get from the last command:
The text was updated successfully, but these errors were encountered: