reenhanced / gitreflow

Reflow automatically creates pull requests, ensures the code review is approved, and squash merges finished branches to master with a great commit message template.
MIT License
1.49k stars 64 forks source link

Setup doesn't work with GH two-factor turned on #175

Closed lakenen closed 8 years ago

lakenen commented 8 years ago

The two-factor code is never sent. Here's the output:

$ git reflow setup

[notice] Created ~/.gitconfig.reflow for Reflow specific configurations
[notice] Added ~/.gitconfig.reflow to ~/.gitconfig include paths
Available remote Git Server services:
1. GitHub
2. BitBucket (team-owned repos only)
Which service would you like to use for this project?  1
Please enter your GitHub username: lakenen
Please enter your GitHub password (we do NOT store this): 
EXECUTED: get - /authorizations with PARAMS: {}
"Connection options : \n"
{:headers=>
  {"Accept"=>
    "application/vnd.github.v3+json,application/vnd.github.beta+json;q=0.5,application/json;q=0.1",
   "Accept-Charset"=>"utf-8",
   "User-Agent"=>"Github API Ruby Gem 0.12.4"},
 :ssl=>
  {:ca_file=>
    "/usr/local/lib/ruby/gems/2.2.0/gems/github_api-0.12.4/lib/github_api/ssl_certs/cacerts.pem"},
 :url=>"https://api.github.com",
 :builder=>
  #<Faraday::RackBuilder:0x007ff96b21fc48
   @handlers=
    [Github::Request::Jsonize,
     Faraday::Request::Multipart,
     Faraday::Request::UrlEncoded,
     Github::Request::BasicAuth,
     Faraday::Response::Logger,
     Github::Response::Mashify,
     Github::Response::Jsonize,
     Github::Response::RaiseError,
     Faraday::Adapter::NetHttp]>}
I, [2016-05-25T12:30:51.378146 #84912]  INFO -- : get https://api.github.com/authorizations
D, [2016-05-25T12:30:51.378219 #84912] DEBUG -- request: Accept: "application/vnd.github.v3+json,application/vnd.github.beta+json;q=0.5,application/json;q=0.1"
Accept-Charset: "utf-8"
User-Agent: "Github API Ruby Gem 0.12.4"
Authorization: "Basic bGFrZW5lbjpKaWbtaWc7U2xpZcAtMA==\""
Please enter your two-factor authentication code: 
codenamev commented 8 years ago

The two-factor auth code isn't sent in the headers the first time around. Can you past the trace of what happens after you enter your auth code?

lakenen commented 8 years ago

I never get an auth code...

codenamev commented 8 years ago

We authenticate with Github by creating a personalized access token for your account to use with git-reflow on the machine you're using to set it up with. In order to do this with two-factor authentication, Github will tell us when we try to create your personal access token (via response headers) that your account requires a two-factor authentication code in order for us to continue. If you see the last line of the backtrace you posted, we ask you for this code. You get this code from either an app (like Google Authenticator), via text message, etc., depending on how you've set up two-factor authentication on Github.

Let me know how else I can help.

lakenen commented 8 years ago

Sorry, I wasn't clear. I have github setup to send me a SMS message. It never gets sent.

codenamev commented 8 years ago

@lakenen can you try to build from source using the current pre-release for 0.8.0?

gem uninstall git_reflow
git clone https://github.com/reenhanced/gitreflow.git && cd gitreflow
git checkout vs-cleanup-new-gh-merge
bundle
bundle exec rake install

Apparently Github won't trigger the SMS for GET requests, so the recommended "fix" is to just send a dummy POST.

lakenen commented 8 years ago

Ok, I did all that, and it's the same problem. I never get a message from GH.

codenamev commented 8 years ago

@lakenen I have fixed and confirmed this works now from that same branch. We are reviewing final changes today for 0.8.0 and should have a release out by tomorrow.

If you want to take advantage of this before the release, from the directory you cloned gitreflow to run:

gem uninstall git_reflow
git pull origin vs-cleanup-new-gh-merge
bundle exec rake install