github-gem icon indicating copy to clipboard operation
github-gem copied to clipboard

json parse error

Open ehaselwanter opened this issue 14 years ago • 10 comments

gh network list /Library/Ruby/Gems/1.8/gems/json-1.4.6/lib/json/common.rb:146:in initialize': A JSON text must at least contain two octets! (JSON::ParserError) from /Library/Ruby/Gems/1.8/gems/json-1.4.6/lib/json/common.rb:146:innew' from /Library/Ruby/Gems/1.8/gems/json-1.4.6/lib/json/common.rb:146:in parse' from /Library/Ruby/Gems/1.8/gems/github-0.5.0/lib/commands/helpers.rb:400:inget_cache'

ehaselwanter avatar Jan 25 '11 18:01 ehaselwanter

In my case, I hadn't told git about my github credentials. From github-gem's readme:

Authentication

To let GitHub know who you are, just have your git config set up with your GitHub username and token.

$ git config --global github.user "your-github-username"
$ git config --global github.token "your-github-token"

You can find your token under your account.

After setting that up, gh network list worked smoothly.

ento avatar Apr 07 '11 22:04 ento

I still see this issue, even after adding those configs. Happens in ruby 1.8.7 and 1.9.2 with github gem versino 0.6.2.

jasonm avatar Jul 21 '11 19:07 jasonm

I also get this error.

encukou avatar Oct 29 '11 14:10 encukou

I had this very frustrating issue for a long time (is spewing a stack trace really the best error message available?) and finally fixed it by removing GITHUB_USER and GITHUB_TOKEN from my gitconfig and hardcoding my actual credentials.

paulp avatar Dec 01 '11 16:12 paulp

I'm having the same problem. None of the proposed solutions work for me.

jjb avatar Jan 18 '12 23:01 jjb

Same error.

savs avatar Jan 22 '12 21:01 savs

Issue here too with ruby 1.9.2p290, json 1.6.5, json-pure 1.5.4 and github 0.6.2

subblue avatar Jan 27 '12 11:01 subblue

The github gem will drop an invalid empty "network cache" file at .git/network-cache if the credentials are busted. Remove it, fix your credentials, then try.

evan avatar Feb 25 '12 19:02 evan

Same error for me, tried with multiple repositories, both personal and part of an organisation.

I tried removing the .git/network_cache file also but it still doesn't work

shaneog avatar Apr 11 '12 14:04 shaneog

This issue isn't relevant currently because the network list command doesn't work at all since GitHub deprecated the v2 API.

akaihola avatar Sep 13 '12 20:09 akaihola