constabulary / gb

gb, the project based build tool for Go
https://getgb.io/
MIT License
2.15k stars 148 forks source link

gb vendor fetch fails when Githhub two factor auth enabled #282

Closed mbrevoort closed 9 years ago

mbrevoort commented 9 years ago

I disabled Github two factor auth and fetched a private repo successfully:

➜  utx-social-files git:(master) ✗ gb vendor fetch github.com/RobotsAndPencils/go-httpcommon
Username for 'https://github.com': mbrevoort
Password for 'https://mbrevoort@github.com':
fetching recursive dependency github.com/Sirupsen/logrus
fetching recursive dependency github.com/gorilla/mux

Then I re-enabled Github two factor auth and gb vendor fetch fails for the same private repo

➜  utx-social-files git:(master) ✗ gb vendor fetch github.com/RobotsAndPencils/go-httpcommon
Username for 'https://github.com': mbrevoort
Password for 'https://mbrevoort@github.com':
remote: Invalid username or password.
fatal: Authentication failed for 'https://github.com/RobotsAndPencils/go-httpcommon/'
skipping insecure protocol: git://github.com/RobotsAndPencils/go-httpcommon
Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
skipping insecure protocol: http://github.com/RobotsAndPencils/go-httpcommon
FATAL command "fetch" failed: vcs probe failed, tried: https://github.com/RobotsAndPencils/go-httpcommon,ssh://github.com/RobotsAndPencils/go-httpcommon
FATAL command "vendor" failed: exit status 1
mbrevoort commented 9 years ago

Also, is there a way for gb vendor to user my ssh key and clone over ssh rather than asking me for credentials every time?

mbrevoort commented 9 years ago

Somewhat related (with two factor auth disabled), it also seems to ask me for credentials twice and then each time for a recursive dependency.

➜  utx-social-files git:(master) ✗ gb vendor fetch github.com/RobotsAndPencils/file-upload-helper/upload
Username for 'https://github.com': mbrevoort
Password for 'https://mbrevoort@github.com':
Username for 'https://github.com': mbrevoort
Password for 'https://mbrevoort@github.com':
fetching recursive dependency github.com/RobotsAndPencils/file-upload-helper/s3
Username for 'https://github.com': mbrevoort
Password for 'https://mbrevoort@github.com':
Username for 'https://github.com': mbrevoort
Password for 'https://mbrevoort@github.com':
davecheney commented 9 years ago

Thanks for the report. I do not know offhand if we even try the git+ssh scheme by default. The problem with probing for schemes is the correct order depends on your point of view -- most people want https to be proved first, and that will succeed, but will prompt you for credentials often.

On Thu, 30 Jul 2015 07:19 Mike Brevoort notifications@github.com wrote:

Also, is there a way for gb vendor to user my ssh key and clone over ssh rather than asking me for credentials every time?

— Reply to this email directly or view it on GitHub https://github.com/constabulary/gb/issues/282#issuecomment-126098512.

davecheney commented 9 years ago

That behaviour is because we probe, then checkout. See previous discussion of auto detecting the scheme.

On Thu, 30 Jul 2015 07:30 Mike Brevoort notifications@github.com wrote:

Somewhat related (with two factor auth disabled), it also seems to ask me for credentials twice and then each time for a recursive dependency.

➜ utx-social-files git:(master) ✗ gb vendor fetch github.com/RobotsAndPencils/file-upload-helper/upload

Username for 'https://github.com': mbrevoort Password for 'https://mbrevoort@github.com': Username for 'https://github.com': mbrevoort Password for 'https://mbrevoort@github.com'

: fetching recursive dependency github.com/RobotsAndPencils/file-upload-helper/s3

Username for 'https://github.com': mbrevoort Password for 'https://mbrevoort@github.com': Username for 'https://github.com': mbrevoort Password for 'https://mbrevoort@github.com':

— Reply to this email directly or view it on GitHub https://github.com/constabulary/gb/issues/282#issuecomment-126101333.