Github: An unknown error ocurred

Created on 12 Jul 2017  路  29Comments  路  Source: atom/github

Is this how to solve this problem?
2017-07-12 at 13 35

duplicate

Most helpful comment

I fixed it by going to
github.com > settings > Authorized OAuth Apps > GitHub for Atom > grant permissions

All 29 comments

Yeah, I just got this issue when I tried to use it on a new Ubuntu machine.

EDIT:
The error only appears on forked repos

@zhuziyi1989 - do you remember the URL you tried to pin? You can also get it from your .git/config file from the atomPrUrl entry (feel free to mask the account/repo name if you want).

Also, it's super helpful if you can fill out the issue template since it contains a lot of baseline information (e.g. what version of Atom are you running? Which operating system are you on? Can you reproduce in safe mode?).

@Rantahu - so you're trying to pin a URL for a pull request in a forked repository and you get that error? If you can share specific steps to reproduce, that would be helpful.

I have the exact same issue. The GitHub tab in Atom (1.18.0, Fedora 26) will just act as shown in the video above. If I click "Try Again", it goes back to the error message. It's like this since I've installed Atom on this Fedora machine.
The Git tab, on the other hand, works fine.

@mzannoni can you confirm that you get to that state after entering a pull request to pin? Also, do you see any errors in dev tools console (Window: Toggle Dev Tools then click the Console tab)?

I have same issue on Atom version(1.18.0). On Dev mode panel, show error that

Server request for query `Pr` failed for the following reasons:

1. Could not resolve to a Repository with the name '[MY_GITHUB_REPOSITORY_NAME]'.
   agment F4 on Query {_repository1CJN9J:repository(owner:"MY_GITHUB_REPOSITORY_OWNER_NAME
                       ^^^                       

@rsese I think I first got the error just after installation, when I entered the token from GitHub website to link the account.
Regarding the errors in Dev Tools Console, I see exactly what's just been reported above by @aritaku.

I run this:
git config --unset branch.master.atomprurl

Exactly the same issue on another machine with Ubuntu 16.04 and Atom 1.18.
It happened just after I entered the login token and clicked "Login".
Same output in the Console of the Dev Tools.

On this Ubuntu machine the Github tab was working correctly before, until the last Atom update, I think. But I have this machine since a few years and I'm sure it was working before.

I think I have the same issue, happening right after I first tried to connect recently installed Atom to a github repo and entered the token.

It was the master branch of a repo I had just initialized and added a remote for on Github in the CLI. Had one empty text file committed. I'm new to Atom/Github so I was just seeing how things work.

The only unusual thing I did before having the error was that I had an Atom project open with another folder that had a local git repo. I either removed the old folder then added the new one, or added the new one then removed the old one, I can't remember which.

I'm running Atom 1.18.0 on Ubuntu 16.04.2 on VirtualBox 5.1.22 r115126 (Qt5.6.2) and this is the first time I've tried connecting the preview pane, so I could certainly be doing something wrong or have a problem at my end. It seems like an identical situation/outcome to those above so I thought I'd share my case.

@rsese Yeah the url I have in the config is the forked repo. I went through the same process as @mzannoni with the same os and atom build.

I played with this more and found I could reproduce if the repository I'm working with was private and the token used to login didn't have the right permissions to access the repository (as described in https://github.com/atom/github/issues/922#issuecomment-308210879).

Can folks running into this try the command mentioned in the comment I linked to above to see if the token you're logging in with has access to the repository you're working with? E.g.:

curl https://api.github.com/repos/OWNER/REPO -H "Authorization: token TOKEN"

I'm not quite sure we're talking about the same thing here... or at least, you're maybe given for granted that I'm an Atom coding expert.
I don't know how the token relate to a specific repo... Namely, the mentioned token is generated by a GitHub webpage that I reached with a link from the Atom GitHub tab when I wanted to login the first time, and I wouldn't know where to find this TOKEN again to be used in the above mentioned command. I believe I need some more guidance here...
Regarding the comment mentione, I don't have an "atomPrUrl" entry in any of the .git/config files of any of the repo I'm working with.
Again, I'm sorry if I can't really be helpful here, but I think we're talking about different tokens maybe... Is there a way to "reset" the GitHub tab in Atom so that I'm directed again to GitHub website to get a new token, for example? So that I can do from a different repo, for example. This issue with the GitHub tab is exactly the same with all the repo I have.

I'm having a very similar experience. To my recollection, there are explicit instructions that one can't go and look up the token in question again?

Same goes for not having an atomPr Url entry in .git/config

Unfortunately have the same issue.

@rsese I receive the same aforementioned error, with curl the JSON response has "not found" in message field.

I fixed it by going to
github.com > settings > Authorized OAuth Apps > GitHub for Atom > grant permissions

@mzannoni - sorry maybe just to take a step back, is the repository you're working on a private repository? And if so, is it owned by your user account or by an organization account? The token that you copied from github.atom.io/login is likely saved by a credential helper, on Windows it would be under Control Panel > Credential Manager and on macOS it would in Keychain Access. I just checked on my Windows 10 machine and it's listed as atom-github/https://api.github.com under Windows Credentials.

If you delete this entry, then the GitHub tab will prompt you to login again and it will give you another token.

Can you open a public repository of yours and see if that works?

To my recollection, there are explicit instructions that one can't go and look up the token in question again?

@JFAmprimoz - if you're on macOS you can see the token saved in Keychain Access but on Windows I don't think you can. But you can remove it (as I described above) so the next time you go to the GitHub tab, you'll be asked to login again and you'll be given another token.

Can you confirm if the repository you're working on is a private repository owned by an organization account? Or is it one of your repos?

@theholiday @chrisvoo - are you working on a repository owned by your account or by an organization account?

@HarveyThayer - based on your description, it sounds like you were working with a private repository under an organization account? The organization likely had 3rd party access restrictions enabled so you would need to grant access to the organization for GitHub for Atom for it to work.

@rsese I'm using only private repos of my organization thus far, I don't have any public personal repo in GitHub, yet. I'm neither on Win nor on Mac, I'm on Linux Fedora. However, following your suggestion, I've found the token stored in Seahorse (Gnome Password Manager) and deleted it. Then I've tried to login again, with the exact same outcome.
Is this because it's a provate repo? Is the GitHub tab not supposed to work with private repos then? And if so, why is that?
The Git tab works perfectly with those repos.
Thanks a lot for your help, by the way.

@rsese yes, seems to me that was the problem. Private repository in organization account from which I have to have an approve. Thanks. Would be great if the error message in Atom was more informable.

@rsese yes I had this same issue for a private repo that I'm in control of and to fix it I had to grant permissions to the tokens from GitHub itself. Me and my team can now access the tab.

@rsese I'm using only private repos of my organization thus far, I don't have any public personal repo in GitHub, yet. I'm neither on Win nor on Mac, I'm on Linux Fedora. However, following your suggestion, I've found the token stored in Seahorse (Gnome Password Manager) and deleted it. Then I've tried to login again, with the exact same outcome.
Is this because it's a provate repo? Is the GitHub tab not supposed to work with private repos then?

@mzannoni - ahhh great thanks for confirming. The GitHub tab can work with private repositories, what's likely happening is that the organization that owns the repository has OAuth App restrictions enabled (it's been enabled by default for new organizations for a while):

https://help.github.com/articles/about-oauth-app-access-restrictions/

If this is the case, an organization owner needs to specifically approve the "GitHub for Atom" application. It sounds like you're an organization owner, so you can do this from your account settings:

https://github.com/settings/applications

Click on "GitHub for Atom" and then find your organization and click the Grant button.

@rsese Thanks a lot, now that we've authorized the app for the organization it works fine. I didn't know before, I though it should work just as the GitHub Desktop for Windows does, since also Atom is from GitHub... but apparently that's not the case.
Is there a reason why the GitHub Desktop is authorized by default and GitHub for Atom not? (...or maye we've also authorized GitHub Desktop some time ago and we don't rememeber...)

@rsese ...and just a little suggestion for further development... It would be much better if GitHub for Atom would give some indication about the error and how to fix things, since it's actually wanted that it behaves like this, instead of just an "unknown error"...

Is there a reason why the GitHub Desktop is authorized by default and GitHub for Atom not? (...or maye we've also authorized GitHub Desktop some time ago and we don't rememeber...)

Yeah the native Desktop apps worked a bit differently and also may have been special cased - I'll ask the team about this.

It would be much better if GitHub for Atom would give some indication about the error and how to fix things, since it's actually wanted that it behaves like this, instead of just an "unknown error"...

:+1: - that's what's discussed in https://github.com/atom/github/issues/922 so there's an issue for that if you want to subscribe. I think that this issue is a duplicate of that one too, it seems like people that have run into this error were running into OAuth App restrictions so I'll go ahead and close it.

If anyone is still having a problem though, let me know :v:

me on parrot having same issue. i saw my oauth permissions and they're fine. even uninstalled atom installed it back and set up a new user. still the same error

In my case the solution was to check the .git/config file in the project folder.

changed the line

url = https://github.com/a-salimkhanov/[repo-name]/

to this

url = https://github.com/a-salimkhanov/[repo-name].git

Changed "/" to ".git" at the end of the url.
Check it. Maybe that's the problem in your case too.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

UziTech picture UziTech  路  4Comments

move[bot] picture move[bot]  路  3Comments

joshaber picture joshaber  路  4Comments

megaultrachicken picture megaultrachicken  路  4Comments

ccavolt picture ccavolt  路  3Comments