Skip to content
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

GitHub issue on git reflow setup --> 404 #250

Open
togume opened this issue Apr 19, 2021 · 10 comments
Open

GitHub issue on git reflow setup --> 404 #250

togume opened this issue Apr 19, 2021 · 10 comments

Comments

@togume
Copy link

togume commented Apr 19, 2021

Hello! I'm getting the following error when doing git reflow setup on a new machine:

/Users/togume/.asdf/installs/ruby/3.0.0/lib/ruby/gems/3.0.0/gems/git_reflow-0.9.5/lib/git_reflow/git_server/git_hub.rb:146:in `rescue in authenticate': We were unable to authenticate with Github. (RuntimeError)
	from /Users/togume/.asdf/installs/ruby/3.0.0/lib/ruby/gems/3.0.0/gems/git_reflow-0.9.5/lib/git_reflow/git_server/git_hub.rb:107:in `authenticate'
	from /Users/togume/.asdf/installs/ruby/3.0.0/lib/ruby/gems/3.0.0/gems/git_reflow-0.9.5/lib/git_reflow/git_server.rb:17:in `connect'
	from /Users/togume/.asdf/installs/ruby/3.0.0/lib/ruby/gems/3.0.0/gems/git_reflow-0.9.5/lib/git_reflow/workflows/core.rb:51:in `block (3 levels) in <class:Core>'
	from /Users/togume/.asdf/installs/ruby/3.0.0/lib/ruby/gems/3.0.0/gems/highline-2.0.3/lib/highline/menu.rb:449:in `value_for_selected_item'
	from /Users/togume/.asdf/installs/ruby/3.0.0/lib/ruby/gems/3.0.0/gems/highline-2.0.3/lib/highline/menu.rb:415:in `select'
	from /Users/togume/.asdf/installs/ruby/3.0.0/lib/ruby/gems/3.0.0/gems/highline-2.0.3/lib/highline.rb:277:in `choose'
	from /Users/togume/.asdf/installs/ruby/3.0.0/lib/ruby/3.0.0/forwardable.rb:238:in `choose'
	from /Users/togume/.asdf/installs/ruby/3.0.0/lib/ruby/3.0.0/forwardable.rb:238:in `choose'
	from /Users/togume/.asdf/installs/ruby/3.0.0/lib/ruby/gems/3.0.0/gems/git_reflow-0.9.5/lib/git_reflow/workflows/core.rb:47:in `block in <class:Core>'
	from /Users/togume/.asdf/installs/ruby/3.0.0/lib/ruby/gems/3.0.0/gems/git_reflow-0.9.5/lib/git_reflow/workflow.rb:184:in `block in command'
	from /Users/togume/.asdf/installs/ruby/3.0.0/lib/ruby/gems/3.0.0/gems/git_reflow-0.9.5/lib/git_reflow.rb:52:in `method_missing'
	from /Users/togume/.asdf/installs/ruby/3.0.0/lib/ruby/gems/3.0.0/gems/git_reflow-0.9.5/exe/git-reflow:19:in `public_send'
	from /Users/togume/.asdf/installs/ruby/3.0.0/lib/ruby/gems/3.0.0/gems/git_reflow-0.9.5/exe/git-reflow:19:in `<top (required)>'
	from /Users/togume/.asdf/installs/ruby/3.0.0/bin/git-reflow:23:in `load'
	from /Users/togume/.asdf/installs/ruby/3.0.0/bin/git-reflow:23:in `<main>'
/Users/togume/.asdf/installs/ruby/3.0.0/lib/ruby/gems/3.0.0/gems/github_api-0.19.0/lib/github_api/response/raise_error.rb:19:in `on_complete': GET https://api.github.com/authorizations: 404 - Not Found (Github::Error::NotFound)
See: https://docs.github.com/rest
	from /Users/togume/.asdf/installs/ruby/3.0.0/lib/ruby/gems/3.0.0/gems/faraday-1.4.1/lib/faraday/middleware.rb:19:in `block in call'
	from /Users/togume/.asdf/installs/ruby/3.0.0/lib/ruby/gems/3.0.0/gems/faraday-1.4.1/lib/faraday/response.rb:59:in `on_complete'
	from /Users/togume/.asdf/installs/ruby/3.0.0/lib/ruby/gems/3.0.0/gems/faraday-1.4.1/lib/faraday/middleware.rb:18:in `call'
	from /Users/togume/.asdf/installs/ruby/3.0.0/lib/ruby/gems/3.0.0/gems/faraday-1.4.1/lib/faraday/middleware.rb:18:in `call'
	from /Users/togume/.asdf/installs/ruby/3.0.0/lib/ruby/gems/3.0.0/gems/faraday-1.4.1/lib/faraday/middleware.rb:18:in `call'
	from /Users/togume/.asdf/installs/ruby/3.0.0/lib/ruby/gems/3.0.0/gems/faraday-1.4.1/lib/faraday/middleware.rb:18:in `call'
	from /Users/togume/.asdf/installs/ruby/3.0.0/lib/ruby/gems/3.0.0/gems/github_api-0.19.0/lib/github_api/response/follow_redirects.rb:84:in `perform_with_redirection'
	from /Users/togume/.asdf/installs/ruby/3.0.0/lib/ruby/gems/3.0.0/gems/github_api-0.19.0/lib/github_api/response/follow_redirects.rb:72:in `call'
	from /Users/togume/.asdf/installs/ruby/3.0.0/lib/ruby/gems/3.0.0/gems/github_api-0.19.0/lib/github_api/request/basic_auth.rb:32:in `call'
	from /Users/togume/.asdf/installs/ruby/3.0.0/lib/ruby/gems/3.0.0/gems/faraday-1.4.1/lib/faraday/request/url_encoded.rb:25:in `call'
	from /Users/togume/.asdf/installs/ruby/3.0.0/lib/ruby/gems/3.0.0/gems/faraday-1.4.1/lib/faraday/request/multipart.rb:30:in `call'
	from /Users/togume/.asdf/installs/ruby/3.0.0/lib/ruby/gems/3.0.0/gems/github_api-0.19.0/lib/github_api/request/jsonize.rb:23:in `call'
	from /Users/togume/.asdf/installs/ruby/3.0.0/lib/ruby/gems/3.0.0/gems/faraday-1.4.1/lib/faraday/rack_builder.rb:154:in `build_response'
	from /Users/togume/.asdf/installs/ruby/3.0.0/lib/ruby/gems/3.0.0/gems/faraday-1.4.1/lib/faraday/connection.rb:492:in `run_request'
	from /Users/togume/.asdf/installs/ruby/3.0.0/lib/ruby/gems/3.0.0/gems/faraday-1.4.1/lib/faraday/connection.rb:198:in `get'
	from /Users/togume/.asdf/installs/ruby/3.0.0/lib/ruby/gems/3.0.0/gems/github_api-0.19.0/lib/github_api/request.rb:68:in `call'
	from /Users/togume/.asdf/installs/ruby/3.0.0/lib/ruby/gems/3.0.0/gems/github_api-0.19.0/lib/github_api/request/verbs.rb:23:in `get_request'
	from /Users/togume/.asdf/installs/ruby/3.0.0/lib/ruby/gems/3.0.0/gems/github_api-0.19.0/lib/github_api/client/authorizations.rb:28:in `list'
	from /Users/togume/.asdf/installs/ruby/3.0.0/lib/ruby/gems/3.0.0/gems/github_api-0.19.0/lib/github_api/api.rb:250:in `block in execute'
	from /Users/togume/.asdf/installs/ruby/3.0.0/lib/ruby/gems/3.0.0/gems/github_api-0.19.0/lib/github_api/api.rb:237:in `run_callbacks'
	from /Users/togume/.asdf/installs/ruby/3.0.0/lib/ruby/gems/3.0.0/gems/github_api-0.19.0/lib/github_api/api.rb:249:in `execute'
	from /Users/togume/.asdf/installs/ruby/3.0.0/lib/ruby/gems/3.0.0/gems/github_api-0.19.0/lib/github_api/api.rb:209:in `block in method_added'
	from /Users/togume/.asdf/installs/ruby/3.0.0/lib/ruby/gems/3.0.0/gems/github_api-0.19.0/lib/github_api/api.rb:250:in `block in execute'
	from /Users/togume/.asdf/installs/ruby/3.0.0/lib/ruby/gems/3.0.0/gems/github_api-0.19.0/lib/github_api/api.rb:237:in `run_callbacks'
	from /Users/togume/.asdf/installs/ruby/3.0.0/lib/ruby/gems/3.0.0/gems/github_api-0.19.0/lib/github_api/api.rb:249:in `execute'
	from /Users/togume/.asdf/installs/ruby/3.0.0/lib/ruby/gems/3.0.0/gems/github_api-0.19.0/lib/github_api/api.rb:209:in `block in method_added'
	from /Users/togume/.asdf/installs/ruby/3.0.0/lib/ruby/gems/3.0.0/gems/git_reflow-0.9.5/lib/git_reflow/git_server/git_hub.rb:119:in `authenticate'
	from /Users/togume/.asdf/installs/ruby/3.0.0/lib/ruby/gems/3.0.0/gems/git_reflow-0.9.5/lib/git_reflow/git_server.rb:17:in `connect'
	from /Users/togume/.asdf/installs/ruby/3.0.0/lib/ruby/gems/3.0.0/gems/git_reflow-0.9.5/lib/git_reflow/workflows/core.rb:51:in `block (3 levels) in <class:Core>'
	from /Users/togume/.asdf/installs/ruby/3.0.0/lib/ruby/gems/3.0.0/gems/highline-2.0.3/lib/highline/menu.rb:449:in `value_for_selected_item'
	from /Users/togume/.asdf/installs/ruby/3.0.0/lib/ruby/gems/3.0.0/gems/highline-2.0.3/lib/highline/menu.rb:415:in `select'
	from /Users/togume/.asdf/installs/ruby/3.0.0/lib/ruby/gems/3.0.0/gems/highline-2.0.3/lib/highline.rb:277:in `choose'
	from /Users/togume/.asdf/installs/ruby/3.0.0/lib/ruby/3.0.0/forwardable.rb:238:in `choose'
	from /Users/togume/.asdf/installs/ruby/3.0.0/lib/ruby/3.0.0/forwardable.rb:238:in `choose'
	from /Users/togume/.asdf/installs/ruby/3.0.0/lib/ruby/gems/3.0.0/gems/git_reflow-0.9.5/lib/git_reflow/workflows/core.rb:47:in `block in <class:Core>'
	from /Users/togume/.asdf/installs/ruby/3.0.0/lib/ruby/gems/3.0.0/gems/git_reflow-0.9.5/lib/git_reflow/workflow.rb:184:in `block in command'
	from /Users/togume/.asdf/installs/ruby/3.0.0/lib/ruby/gems/3.0.0/gems/git_reflow-0.9.5/lib/git_reflow.rb:52:in `method_missing'
	from /Users/togume/.asdf/installs/ruby/3.0.0/lib/ruby/gems/3.0.0/gems/git_reflow-0.9.5/exe/git-reflow:19:in `public_send'
	from /Users/togume/.asdf/installs/ruby/3.0.0/lib/ruby/gems/3.0.0/gems/git_reflow-0.9.5/exe/git-reflow:19:in `<top (required)>'
	from /Users/togume/.asdf/installs/ruby/3.0.0/bin/git-reflow:23:in `load'
	from /Users/togume/.asdf/installs/ruby/3.0.0/bin/git-reflow:23:in `<main>'

How do I fix this or how can I help to get this working?

FYI that I'm using multi-factor auth.

@togume
Copy link
Author

togume commented Apr 19, 2021

Workaround: this is preventing the app from creating the Personal Access Token which is stored in ~/.gitconfig.reflow. Therefore, a workaround is to manually add it to the file in order for this to work.

@isaacegglestone
Copy link

Great @togume Where can I find the syntax for adding the PAT manually to the config?

@togume
Copy link
Author

togume commented Apr 28, 2021

@isaacegglestone I didn't find it either and had to guess-hack it 🙈:

~/.gitconfig.reflow

[github]
  site = https://github.com
  endpoint = https://api.github.com
  user = togume
  oauth-token = <PAT>
[reflow]
  git-server = GitHub

@vishalsaugat
Copy link

@togume I have followed the process as described by you. My .gitconfig.reflow looks like this

[github]
	site = https://github.com
	endpoint = https://api.github.com
	user = vishalsaugat
	oauth-token = <PAT>
[reflow]
	git-server = GitHub

I am still getting the above error. After running git reflow review main or git reflow setup, it prompts me to enter username and password after running the command
FYI I am using the Apple M1 silicon ?

Error - We were unable to authenticate with Github.

@togume
Copy link
Author

togume commented May 24, 2021

@vishalsaugat I don't see anything weird, and those commands are working for me. So, silly question, but did you replace <PAT> with the actual personal access you generated from GitHub? https://docs.github.com/en/github/authenticating-to-github/keeping-your-account-and-data-secure/creating-a-personal-access-token

@vishalsaugat
Copy link

@togume Yes I did replace it with my personal access token generated from Github. Github has recently changed the token format for PAT . I hope it's still compatible with the new one ?
Also, after configuring the PAT in .gitconfig.reflow , will it still prompt me for my username and password ?

@togume
Copy link
Author

togume commented May 25, 2021

@vishalsaugat I just tested by creating a new PAT and swapping it out in the .gitconfig.reflow and it worked as expected...

Hhrmmm... very weird.

No, once the PAT is configured and used, it will not prompt you for username and password. I'm also on an M1...

A few ideas:

  • Could it be that you have a different home directory for reflow or git, so it's not finding the file?
  • I'm using asdf to manage environments (Ruby, Node, Python, etc) on the M1 and it is working. Previously, I was using system Ruby/Gems

@vishalsaugat
Copy link

@togume I was able to resolve this. Looks like git_reflow was picking up .gitconfig file instead of .gitconfig.reflow. I changed the PAT in .gitconfig and it's working fine now. Thanks, your idea was helpful.

@togume
Copy link
Author

togume commented May 27, 2021

@vishalsaugat 👏 glad you got it resolved and happy I was able to help.

Ah, yeah - that would do it. The path in .gitconfig is important.

Leaving this open because it's still a workaround to the original issue.

@codenamev
Copy link
Collaborator

Sorry for all the issues here. Glad a workaround was found. We'll have to drop support for creating access keys during the setup process due to GitHub's new changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants