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

Non-interactive installation prompts for git password #1009

Closed
kornelski opened this issue Dec 12, 2013 · 6 comments
Closed

Non-interactive installation prompts for git password #1009

kornelski opened this issue Dec 12, 2013 · 6 comments
Labels

Comments

@kornelski
Copy link
Contributor

$ node
> require('bower').commands.install(['https://github.com/examplebrokenurl/doesnotexist.git'], {}, {interactive:false});
{ _interceptors: [], _piped: [] }
> Username for 'https://github.com':

The git child process can show its own interactive prompt at any time (e.g. git interprets 404 on github as authentication error and wants to retry with a password).

To prevent this you can run git with:

 git -c core.askpass=true …

true here is not a boolean value, but a command /bin/true that will make git think it asked for a password.

cybertk pushed a commit to cybertk/depot_tools that referenced this issue May 22, 2014
git sometimes blocks asking for a password. On a random machine that
didn't know anything about google/chromium, it failed immediately with

"fatal: could not read Username for 'https://chrome-internal.googlesource.com': No such file or directory"

but on my real machine w/o _netrc it blocks and wants this:

Username for 'https://chrome-internal.googlesource.com':
Password for 'https://chrome-internal.googlesource.com':

There's no --non-interactive unfortunately, it's supposed to magically
decide if it's connected to a tty and behave appropriately. It does
not, perhaps because of being wrapped in depot_tools .bat files,
perhaps an msysgit-port bug, perhaps being called from python. Anyway
bower/bower#1009 had a magic incantation
that works for this case: 'true' is available in the msys
distribution.

R=iannucci@chromium.org
BUG=323300

Review URL: https://codereview.chromium.org/182553004

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@253844 0039d316-1c4b-4281-b951-d872f2087c98
@sheerun sheerun added the bug label Jun 9, 2014
@sheerun sheerun added this to the 1.4.0 milestone Jun 9, 2014
@sheerun
Copy link
Contributor

sheerun commented Jun 9, 2014

Scheduling on next release. Do you want to send a PR? It should be fairly easy to implement.

dmitshur added a commit to shurcooL/go that referenced this issue Jul 13, 2014
Fixes potential "Username for 'https://github.com': " interactive
prompts for private repos.
Thank you @pornel for the solution from bower/bower#1009. It took me
half an hour to find a working solution for this problem, which is odd
given that ls-remote is supposed to be a low-level plumbing command to
be used primarily by scripts. :/
svn2github pushed a commit to svn2github/chromium-depot-tools that referenced this issue Oct 10, 2014
git sometimes blocks asking for a password. On a random machine that
didn't know anything about google/chromium, it failed immediately with

"fatal: could not read Username for 'https://chrome-internal.googlesource.com': No such file or directory"

but on my real machine w/o _netrc it blocks and wants this:

Username for 'https://chrome-internal.googlesource.com':
Password for 'https://chrome-internal.googlesource.com':

There's no --non-interactive unfortunately, it's supposed to magically
decide if it's connected to a tty and behave appropriately. It does
not, perhaps because of being wrapped in depot_tools .bat files,
perhaps an msysgit-port bug, perhaps being called from python. Anyway
bower/bower#1009 had a magic incantation
that works for this case: 'true' is available in the msys
distribution.

R=iannucci@chromium.org
BUG=323300

Review URL: https://codereview.chromium.org/182553004

git-svn-id: http://src.chromium.org/chrome/trunk/tools/depot_tools@253844 4ff67af0-8c30-449e-8e8b-ad334ec8d88c
@sheerun
Copy link
Contributor

sheerun commented Oct 15, 2015

I think true won't work on Windows..

@dmitshur
Copy link

@sheerun, according to commit message of svn2github/chromium-depot-tools@cc130b9:

'true' is available in the msys distribution.

@sheerun
Copy link
Contributor

sheerun commented Oct 15, 2015

Bower also supports non-msys installation

@dmitshur
Copy link

Well, another way, if git version 2.3 or later is used, is to use GIT_TERMINAL_PROMPT environment variable.

@sheerun
Copy link
Contributor

sheerun commented Oct 16, 2015

Maybe we can do both, with platform detection :)

dmitshur added a commit to shurcooL/vcsstate that referenced this issue Dec 27, 2015
Fixes potential "Username for 'https://github.com': " interactive
prompts for private repos.
Thank you @pornel for the solution from bower/bower#1009. It took me
half an hour to find a working solution for this problem, which is odd
given that ls-remote is supposed to be a low-level plumbing command to
be used primarily by scripts. :/
@sheerun sheerun closed this as completed in aaaa9cd Apr 4, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

3 participants