Hub: Error creating pull request: Not Found (HTTP 404)

Created on 13 Oct 2013  路  33Comments  路  Source: github/hub

$ hub pull_request -i 836
github.com username: myusername
github.com password for myusername (never stored):
Error creating pull request: Not Found (HTTP 404)
Are you sure that github.com/myorg/myrepo exists?

This repo exists and all other commands work except pull-request.
Only for this command hub asks me for username/password

Most helpful comment

Sharing a solution to this problem that worked for me. My Personal Access Token didn't have the proper permissions. I originally creating it with no permissions. Adjusting the permissions fixed this problem. Also, I'm just exporting GITHUB_TOKEN=... instead of creating ~/.config/hub.

All 33 comments

Do you own issue 836 in that repo, or do you have admin rights for that repo?

Does it ask you for password every time, or just the first time you try it? Is there an OAuth token saved to ~/.config/hub?

I have created issue 836 and I have admin rights for that repo.
It asks me for username/password every time.
There is no ~/.config/hub file.

Seems like a problem with authentication. Are you sure you entered the right password? Do you have two factor auth enabled on GitHub.com?

I am sure password is correct.
When I enter wrong password I get: Error creating pull request: Unauthorized (HTTP 401).
I have two factor auth and I am using Personal Access Tokens as password.

Hmm, maybe there's a bug in hub when Personal Access Tokens are being used. The next release (coming soon) is going to solve two-factor authentication troubles. Until then you can try using the version from master (do rake install from repo) and authenticate using your username and real password (you will be asked for two-factor code).

I did rake install, used real password, then was asked for two-factor code and got:
Error creating pull request: Unauthorized (HTTP 401).
Two-factor code was for sure correct, I even created new one to make 100% sure.

Does ~/.config/hub exist now?

I can't guess where your problem is coming from. I'm going to add more debugging features to hub soon so there will be some flags you can pass to inspect the HTTP requests. In the meantime, can you just try to create an ordinary pull request, and not transform an issue into one? I.e. without -i 836

~/.config/hub still doesn't exist.
hub pull-request resutls in the same error: Error creating pull request: Unauthorized (HTTP 401).

Thanks for your help. I am waiting for the next release then. I hope it will fix my problem.

I had the same problem, but I just created the ~/.config/hub file with:

github.com: 
- oauth_token: <my-token-created-on-github>
  user: <my-github-user>

Changed the permissions of the file to make sure it was secure:

$ chmod go-r ~/.config/hub

and now works fine.

@mislav, since you guys will be fixing this, I think it would be nice to be able to define the Personal Access Token description on the while setting up hub token, to be easier to track it if you have multiple computers using hub.
Normally it shows just as hub in the list (it can be the default tho, if none is given :smile:).

I'm getting this too, tried everything, have no idea why it thinks my repo doesn't exist :|

@dpehrson, did you add the file like I said above?

@alias-mac Yeah hub writes the ~/.config/hub properly and I fixed the permissions, but still no luck. Odd.

@dpehrson, can you provide which hub version you are using (and git)?

I took a shot at updating the README for the setup process that @alias-mac documented and I experienced: https://github.com/github/hub/pull/445

@dpehrson, you can also try to disable 2-factor auth temporarily in Github, setup hub and then activate the 2-factor auth again.

@alias-mac

$ git version
git version 1.8.3.4 (Apple Git-47)
hub version 1.10.6

I am not using two-factor auth. I don't have it set up on my account.

@dpehrson, then that is different, which command are you running? hub pull_request -i <issue>?

git pull-request -b develop which my understanding would "create a new pull request from origin/CURRENT_BRANCH into origin/develop"

@dpehrson, I don't know if that will work, I normally make the PRs from "origin/current_branch" into "upstream/develop" (based on your example).
I use the fork to do the PR, not the same repository.

@dpehrson, I just tried it quickly and it worked:
https://github.com/alias-mac/example/pull/1

Can you provide more info on the issue? Do you have both branches in sync with origin (they exist on Github)? If you do it using Github web interface, it creates the PR?

Well, this started working for me, I honestly have no idea what I did or did differently to make it work. My apologies for tying up your issue.

@gpszymczak Can you install hub from latest master (e.g. brew upgrade hub --HEAD on Mac) and see if your problem got fixed with the most recent changes to authentication?

Gonna close this as fixed in both master and "1.11-stable" branches. This is a part of v1.11 release which is imminent. Please let me know if the issue persists after you tried it on the latest version.

It works. Thanks!

After creating the ~/.config/hub it worked like a charm.

This started happening to me after upgrading to el captian. My ~/.config/hub looks like:

github.com:
- oauth_token: <token>
  user: <username>

and when I try hub pull-request -b dev

I get the following error:

Error creating pull request: Not Found (HTTP 404)
Not Found
Are you sure that github.com/<username>/<organization_name> exists?

Why is the above url github.com/<username>/<organization_name>? I would expect it to just be github.com/<organization_name>

Why is the above url github.com/<username>/<organization_name>?

@eliasbagley That sounds like a separate problem. Could you open a separate issue and give us more detail? git remote -v output is always helpful (you can anonymize certain values, but make sure that the formatting stays intact). Before trying to reproduce, make sure that you're running the latest hub version.

for me this problem occured after transfert project from my account to an organization, and I fixed the error by replacing the good repo url in myrepo/.git/config and restarting GithubDesktop app

This just happened to me, tried to make a pull request (tried 2 times, different branches), both immediately 404'd and don't shop up anywhere:

https://github.com/zyedidia/micro/issues/884
https://github.com/zyedidia/micro/issues/883

Sharing a solution to this problem that worked for me. My Personal Access Token didn't have the proper permissions. I originally creating it with no permissions. Adjusting the permissions fixed this problem. Also, I'm just exporting GITHUB_TOKEN=... instead of creating ~/.config/hub.

As far as I have seen and understand, token set at GITHUB_TOKEN=... has higher precedence than ~/.config/hub.

Was this page helpful?
0 / 5 - 0 ratings