cli: heroku login does not work with cygwin or git bash

This is now fixed. Just update your CLI.

Just run the following

$ heroku update
$ heroku login
OR
$ winpty heroku login -i

Or use cmd.exe instead

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Reactions: 80
  • Comments: 60 (7 by maintainers)

Commits related to this issue

Most upvoted comments

This message was a little unclear for me, so in case anyone is in a similar situation (after I activate 2FA, I received this error), here is what worked for me. I closed out Git Bash then opened the command prompt. From there, I was able to successfully login to heroku through “heroku login”. I then closed the command prompt and re-launched Git Bash and everything worked fine.

In regards to @starrychloe issue, running cmd within Bash/Cygwin probably won’t work either. You may need to close Cygwin and open a fresh command prompt and then login from there.

capture 113

In installing, please chose “Use Windows default console window” fix error

Since my windows user home folder and my cygwin home folder are different, what I did was to heroku login using cmd.exe and then copying C:/Users/MyUser/_netrc to my cygwin home

Login is currently incompatible with git bash/cygwin Log in with Windows cmd.exe, it will work:

rbashish_heroku

rbashish_heroku_cmd

if you run winpty heroku login it will work. We’re in the process of making this automatic

If you are running windows

  1. Search on start menu “cmd”
  2. Right click on cmd & select “Run as Administrator”
  3. Type “heroku login”
  4. Enter email & password to login. Enjoy 2017-06-05_173154

This is inconsistent. I installed Heroku into Cygwin using the standalone installer (https://toolbelt.heroku.com/install.sh) which worked fine (once I removed all the sudo commands in the install script). Some commands such as heroku apps and heroku logs work fine in the Cygwin shell (and ask for login) whereas directly calling heroku login or commands like heroku stack:set come up with the message that

Login is currently incompatible with git bash/Cygwin

pointing to this issue.

Because I installed the toolbelt using Cygwin, to run it using cmd I have to run

C:\Users\username\AppData\Local\heroku\heroku-cli

It would be nice if this would get fixed, but in the mean time, the best way to launch a cmd prompt from a different (cygwin/git bash/etc.) shell is to run

$ start cmd

for git-bash I prefer alias for herok cmd like this one: alias heroku='winpty /c/tools/heroku/bin/heroku.cmd' (my path for heroku.cmd is C:\tools\heroku\bin\heroku.cmd) stored in %HOMEDRIVE%%HOMEPATH%\.bashrc and them I can simple using heroku cmd in git-bash like heroku login / heroku auth:login without any additional tricks.

I am using Windows 10 and installed the 64 bit Windows install and was able to login with @eappleby solution (cmd.exe) and like @weidmaster (& many others) I want to use git bash.

I uninstalled the 64 bit Windows install and used Chocolately to install Heroku-cli and it works with git bash.

@rbashish It appears that you did not enter your email or password correctly. I have been able to login successfully via cmd.exe. Could you please try again?

Use CMD in windows

@eappleby suggestion is the preferred solution right now, run heroku login using the windows command prompt. This will drop your API key into your netrc, at which point you can open up cygwin or git bash and do whatever you need to. The root cause of this problem is that stdin is not a real terminal, so we cannot turn off the echo during the password request. One solution we have considered is popping up a dialog to get the username password as this is what git does within git bash, but I am not sure how soon I will be able to get to this.

use cmd.exe to login then

@SPurno Faruk Ahmed, this thread is about git/cygwin.

Simple fix. Install Heroku on Windows machine as per the site instructions. Then, with Git Bash closed open the windows “Command Prompt” and type “heroku login”. You will be prompted for your Heroku username and password and you’re in! Close the command prompt and use bash as per normal.

For me logging through cmd.exe didn’t save the credentials, so my cygwin/babun on Win7 x64 would ask for them again after heroku create.

But helped what @npalmius said:

Even better, just run cygstart zsh from the bash shell, then run heroku login, then close the zsh shell and bash works just fine. I used standalone method to install.

EDIT: but later when doing git push heroku master I got:

git: ‘credential-wincred’ is not a git command. See ‘git --help’. Username for ‘https://git.heroku.com’: Password for ‘https://user@git.heroku.com’: git: ‘credential-wincred’ is not a git command. See ‘git --help’. remote: ! WARNING: remote: ! Do not authenticate with username and password using git. remote: ! Run heroku login to update your credentials, then retry the git command. remote: ! See documentation for details: https://devcenter.heroku.com/articles/git#http-git-authentication fatal: Authentication failed for ‘https://git.heroku.com/my-app-666.git/

I did two things simulatneously and don’t know which fixed it:

  1. Because I closed that bash session which worked with heroku create, I did again heroku login in cmd.exe pointed at E:\Tools\babun\cygwin\usr\local\lib\heroku\bin\
  2. in my cygwin\home\MyName folder I copied the _netrc to .netrc

Also, checked that both _netrc files in C:\Users\MyName and E:\Tools\babun\cygwin\home\MyName have the same value, and that include entries for machine git.heroku.com and machine api.heroku.com

switching to ms cmd shell by typing cmd in cygwin terminal, and then back to bash sh by typing sh

Got this error when using Mobaxterm:- image

When can I expect the fix?

I got this when I tried to login… image

@CMCDragonkai, nice one 😃

Even better, just run cygstart zsh from the bash shell, then run heroku login, then close the zsh shell and bash works just fine.

What I really don’t understand about this issue though is that other programs like ssh work fine hiding the password.

Sorry, I dont get it, what the solution here?