Skip to content

~/.config/gh/hosts.yml stopped working to authenticate #1320

@olgabot

Description

@olgabot

Describe the bug

Hello, I had configured gh cli on my laptop and then wanted to use it on a headless system. I copied the configuration over with scp:

(base)
 Sat  4 Jul - 13:12  ~ 
  scp -r ~/.config/gh/config.yml olga@ndnd.czbiohub.org:~

And this worked for a bit, but with the 0.10.1 release, I can no longer create PRs in the command line due to lack of authentication.

Version info:

(base)
 Sat  4 Jul - 13:09  ~/code/tabula-microcebus--olgabot/update-muscle-annotations/00_data_ingest/01_global_object   olgabot/update-muscle-annotations 3● 
 olga@ndnd  gh --version
gh version 0.10.1 (2020-06-24)
https://github.com/cli/cli/releases/tag/v0.10.1

Steps to reproduce the behavior

  1. Type gh or create
  2. Press Enter to create a new authentication
  3. See error

Expected vs actual behavior

I expected to be able to create a PR from the command line using the configuration in ~/.config/gh/config.yml

Logs

Details
(base)
 ✘  Sat  4 Jul - 13:08  ~/code/tabula-microcebus--olgabot/update-muscle-annotations/00_data_ingest/01_global_object   olgabot/update-muscle-annotations 3● 
 olga@ndnd  gh pr create
Notice: additional authorization required
Press Enter to open github.com in your browser...
/usr/bin/xdg-open: 851: /usr/bin/xdg-open: www-browser: not found
/usr/bin/xdg-open: 851: /usr/bin/xdg-open: links2: not found
/usr/bin/xdg-open: 851: /usr/bin/xdg-open: elinks: not found
/usr/bin/xdg-open: 851: /usr/bin/xdg-open: links: not found
/usr/bin/xdg-open: 851: /usr/bin/xdg-open: lynx: not found
/usr/bin/xdg-open: 851: /usr/bin/xdg-open: w3m: not found
xdg-open: no method available for opening 'https://github.com/login/oauth/authorize?client_id=178c6fc778ccc68e1d6a&redirect_uri=http%3A%2F%2F127.0.0.1%3A45829%2Fcallback&scope=repo+read%3Aorg+gist&state=2096feba2f8839190b33'
error opening web browser: exit status 3
Please open the following URL manually:
https://github.com/login/oauth/authorize?client_id=178c6fc778ccc68e1d6a&redirect_uri=http%3A%2F%2F127.0.0.1%3A45829%2Fcallback&scope=repo+read%3Aorg+gist&state=2096feba2f8839190b33
If you are on a server or other headless system, use this workaround instead:
  1. Complete authentication on a GUI system;
  2. Copy the contents of `~/.config/gh/hosts.yml` to this system.
^C
(base)
 ✘  Sat  4 Jul - 13:09  ~/code/tabula-microcebus--olgabot/update-muscle-annotations/00_data_ingest/01_global_object   olgabot/update-muscle-annotations 3● 
 olga@ndnd  cat ~/.config/gh/hosts.yml
github.com:
    user: olgabot
    oauth_token: 123abc

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions