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

Created on 28 Sep 2015  Â·  59Comments  Â·  Source: heroku/cli

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

Most helpful comment

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.

All 59 comments

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

I get this error since I enabled 2fa on my account

I have installed newest Git... It may be certificates?

Any update here?

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

whats the solution?

It works with ZSH. cygstart zsh.

> $ heroku login 
> Installing Heroku Toolbelt v4... done. 
> For more information on Toolbelt v4: https://github.com/heroku/heroku-cli 
> heroku-cli: Adding dependencies... ! mkdir $USERPROFILE\AppData\Local\heroku\tmp\node358338010\npm-3.3.10\node_modules\fstream-npm\node_modules\fstream-ignore\node_modules\minimatch\node_modules\brace-expansion\node_modules: The filename or extension is too long. 
> done 
> heroku-cli: Adding dependencies... ! mkdir $USERPROFILE\AppData\Local\heroku\tmp\node489516235\npm-3.3.10\node_modules\fstream-npm\node_modules\fstream-ignore\node_modules\minimatch\node_modules\brace-expansion\node_modules: The filename or extension is too long. 
> done 
> heroku-cli: Installing core plugins...Error reading plugin heroku-cli-addons. Reinstalling... Error reading plugin heroku-cli-addons. Reinstalling... Error reading plugin heroku-cli-addons. Reinstalling... Error reading plugin heroku-cli-addons. Reinstalling... Error reading plugin heroku-cli-addons. Reinstalling... Error reading plugin heroku-cli-addons. Reinstalling... Error reading plugin heroku-cli-addons. Reinstalling... Error reading plugin heroku-cli-addons. Reinstalling... Error reading plugin heroku-cli-addons. Reinstalling... Error reading plugin heroku-cli-addons. Reinstalling... Error reading plugin heroku-cli-addons. Reinstalling... Error reading plugin heroku-cli-addons. Reinstalling... Error reading plugin heroku-cli-addons. Reinstalling... Error reading plugin heroku-cli-addons. Reinstalling... Error reading plugin heroku-cli-addons. Reinstalling... Error reading plugin heroku-cli-addons. Reinstalling... Error reading plugin heroku-cli-addons. Reinstalling... Error reading plugin heroku-cli-addons. Reinstalling... Error reading plugin heroku-cli-addons. Reinstalling... Error reading plugin heroku-cli-addons. Reinstalling... Error reading plugin heroku-cli-addons. Reinstalling... Error reading plugin heroku-cli-addons. Reinstalling... Error reading plugin heroku-cli-addons. Reinstalling... Error reading plugin heroku-cli-addons. Reinstalling... Error reading plugin heroku-cli-addons. Reinstalling... Error reading plugin heroku-cli-addons. Reinstalling... Error reading plugin heroku-cli-addons. Reinstalling... Error reading plugin heroku-cli-addons. Reinstalling... Error reading plugin heroku-cli-addons. Reinstalling... Error reading plugin heroku-cli-addons. Reinstalling... Error reading plugin heroku-cli-addons. Reinstalling... Error reading plugin heroku-cli-addons. Reinstalling... Error reading plugin heroku-cli-addons. Reinstalling... Error reading plugin heroku-cli-addons. Reinstalling... Error reading plugin heroku-cli-addons. Reinstalling... Error reading plugin heroku-cli-addons. Reinstalling... Error reading plugin heroku-cli-addons. Reinstalling... Error reading plugin heroku-cli-addons. Reinstalling... Error reading plugin heroku-cli-addons. Reinstalling... Error reading plugin heroku-cli-addons. Reinstalling... Error reading plugin heroku-cli-addons. Reinstalling... Error reading plugin heroku-cli-addons. Reinstalling... Error reading plugin heroku-cli-addons. Reinstalling... Error reading plugin heroku-cli-addons. Reinstalling... Error reading plugin heroku-cli-addons. Reinstalling... Error reading plugin heroku-cli-addons. Reinstalling... Error reading plugin heroku-cli-addons. Reinstalling... Error reading plugin heroku-cli-addons. Reinstalling... Error reading plugin heroku-cli-addons. Reinstalling... Error reading plugin heroku-cli-addons. Reinstalling... Error reading plugin heroku-cli-addons. Reinstalling... Error reading plugin heroku-cli-addons. Reinstalling... Error reading plugin heroku-cli-addons. Reinstalling... Error reading plugin heroku-cli-addons. Reinstalling... Error reading plugin heroku-cli-addons. Reinstalling... Error reading plugin heroku-cli-addons. Reinstalling... Error reading plugin heroku-cli-addons. Reinstalling... Error reading plugin heroku-cli-addons. Reinstalling... Error reading plugin heroku-cli-addons. Reinstalling... Error reading plugin heroku-cli-addons. Reinstalling... Error reading plugin heroku-cli-addons. Reinstalling... Error reading plugin heroku-cli-addons. Reinstalling... Error reading plugin heroku-cli-addons. Reinstalling... Error reading plugin heroku-cli-addons. Reinstalling... Error reading plugin heroku-cli-addons. Reinstalling... Error reading plugin heroku-cli-addons. Reinstalling... Error reading plugin heroku-cli-addons. Reinstalling... Error reading plugin heroku-cli-addons. Reinstalling... Error reading plugin heroku-cli-addons. Reinstalling... Error reading plugin heroku-cli-addons. Reinstalling... Error reading plugin heroku-cli-addons. Reinstalling... Error reading plugin heroku-cli-addons. Reinstalling... Error reading plugin heroku-cli-addons. Reinstalling... Error reading plugin heroku-cli-addons. Reinstalling... Error reading plugin heroku-cli-addons. Reinstalling... Error reading plugin heroku-cli-addons. Reinstalling... Error reading plugin heroku-cli-addons. Reinstalling... Error reading plugin heroku-cli-addons. Reinstalling... Error reading plugin heroku-cli-addons. Reinstalling... Error reading plugin heroku-cli-addons. Reinstalling... Error reading plugin heroku-cli-addons. Reinstalling... Error reading plugin heroku-cli-addons. Reinstalling... Error reading plugin heroku-cli-addons. Reinstalling... ! Command cancelled.

Need this fixed. Cannot run pg:ps command. I have psql in Cygwin.

C:\Users\Chloe\workspace\ShopWiz>heroku pg:ps
 !    The local psql command could not be located
 !    For help installing psql, see https://devcenter.heroku.com/articles/heroku-postgresql#local-setup

Tried cmd in Cygwin but it didn't work.

Chloe@xps ~/workspace/ShopWiz
$ cmd
Microsoft Windows [Version 6.3.9600]
(c) 2013 Microsoft Corporation. All rights reserved.

C:\Users\Chloe\workspace\ShopWiz>heroku pg:ps
heroku pg:ps
Enter your Heroku credentials.
Email: [email protected]
Password (typing will be hidden):
Login is currently incompatible with git bash/cygwin
In the meantime, login via cmd.exe
https://github.com/heroku/heroku-cli/issues/84

C:\Users\Chloe\workspace\ShopWiz>

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.

@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.

@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.

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

rbashish_heroku

rbashish_heroku_cmd

@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?

@ransombriggs Thank you for replying. Apparently I have stated the reason that login will not work in Git Bash and it will work on cmd.exe. Please read the second line.

And Intentionally, I have input the wrong email id and password to show that it does not give error as it used to give in Git bash.

I got this when I tried to login...
image

@velo Try using "cmd prompt". If you get the same error then there might be some problems with the dependent software - try reinstalling it.

@velo Could you open a separate issue? Could you include how you configured /cygdrive? The heroku command when run from cygwin basically re-executes itself with the ruby that is installed as part of the toolbelt. This is the line that is failing for you https://github.com/heroku/heroku/blob/master/resources/exe/heroku#L4 because $0 has /cygdrive prefixed in front of it.

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

Got this error when using Mobaxterm:-
image

When can I expect the fix?

We've looked at this a few times and haven't found a way to actually make this work in git bash. It would probably involve some low level API calls. With windows bash (and given there is already an easy workaround) on the horizon, it's unlikely we'll put much effort into this. If anyone want to submit a PR I would happily review it though.

To expand upon what @dickeyxxx said, the underlying problem is that stdin in Git Bash is not actually a tty, and therefore the standard way of silencing it for reading a password does not work properly. This command is written in Go, and we looked in vain for solutions to this previously, but if someone knows of a package that can accomplish this, that would also be helpful as well.

@dickeyxxx Yeah, will be awesome to have this feature! ;)

On windows, click the start icon and in the search type heroku. The first result should be heroku command prompt , just click Run command - this command prompt will allow you to log in by typing your username and password without the error messages.

But I'm already logged in through Windows CMD.EXE!

C:\Users\Chloe\workspace\bestsales>heroku config
=== bestsales Config Vars
Chloe@xps ~/workspace/bestsales
$ heroku config
Enter your Heroku credentials.
Email: [email protected]
Password (typing will be hidden):
 !    Login is currently incompatible with git bash/cygwin
 !    In the meantime, login via cmd.exe
 !    https://github.com/heroku/cli/issues/84

Why not just turn off echo?

http://stackoverflow.com/questions/2338889/how-to-hide-password-input-from-terminal-in-ruby-script
http://www.caliban.org/ruby/ruby-password/classes/Password.html

Enter your Heroku credentials.
Email: [email protected]
Password (typing will be hidden):
 !    Login is currently incompatible with git bash/cygwin
 !    In the meantime, login via cmd.exe
 !    https://github.com/heroku/cli/issues/84

Alright, at least it's a well-know issue.

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

Use CMD in windows

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

when i try to start heroku its showing me that error:

UNABLE_TO_GET_ISSUER_CERT_LOCALLY: unable to get local issuer certificate

how to fix it?

please help me!

@matan10 could you please open a separate issue? when you do, could please also indicate if you are you behind a proxy server or company firewall?

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://[email protected]':
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

capture 113

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

Thanks TranHoangQuoc That worked perfect (y)

Can I log into heroku using cmd and still continue with the rest with git bash?

@umarriqbal you should be able to use git bash after successfully logging in with cmd.exe. When you login, it adds an entry to your netrc file which both shells should be able to pick up the netrc file. Let me know if it does not work for you.

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.

Hey @Firefly4266 - I did exactly that and I still get the following error:

Login is currently incompatible with git bash/Cygwin/MinGW

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

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

Install Linux :laughing:

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

I am still getting "Login is currently incompatible with git bash/Cygwin/MinGW" when entering 'heroku login', even when using the Windows CMD as an Administrator. I am using WIndows 10 Pro. Perhaps I should uninstall heroku and reinstall using 32-bit. Anyone else experiencing this, too?

@protrudamus try running winpty heroku login

Jeff, thanks for the suggestion. Unfortunately, my system does not recognize ‘winpty’ as a valid command. I don’t have the required libraries to support winpty.

I have tried the ‘heroku login’ using Windows command line, PowerShell, Git CMD, and GitBash but no luck.

Is there a way to get more logging of the error? Is there a dump file created?

Thanks, again.

Regards,

Bill Long

From: Jeff Dickey [mailto:[email protected]]
Sent: Wednesday, July 26, 2017 5:53 PM
To: heroku/cli
Cc: Bill Long; Mention
Subject: Re: [heroku/cli] heroku login does not work with cygwin or git bash (#84)

@protrudamus https://github.com/protrudamus try running winpty heroku login

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub https://github.com/heroku/cli/issues/84#issuecomment-318193841 , or mute the thread https://github.com/notifications/unsubscribe-auth/AFSzkJfRtDrUKXplL57qwhSPd-89Nbz9ks5sR7UpgaJpZM4GFQ14 . https://github.com/notifications/beacon/AFSzkA1APz2BwptKx2XABg_SfYmUHFQwks5sR7UpgaJpZM4GFQ14.gif

use cmd.exe to login then

Have tried cmd.exe as an Administrator several times and several ways. Initially after installation, and after uninstalling heroku and then reinstalling heroku. Have also tried PowerShell, Git CMD, and Git Bash. "Login is currently incompatible with git bash/Cygwin/MinGW".

This error shows up because it's not a tty. It should be a tty in cmd.exe as long as you're calling it normally. It isn't a tty in git bash or cygwin. Somehow you'll have to make it a tty just for the login. If nothing else you could set HEROKU_API_KEY to a valid API key and you won't need to login.

Jeff, you assume more experience to me than I have. I apologize for taking so much of your time, but I have chosen to close this ticket. I am not a developer and this troubleshooting exercise has exceeded my grasp.

Thank you again for your help.

Regards,

Bill Long

From: Jeff Dickey [mailto:[email protected]]
Sent: Thursday, July 27, 2017 1:02 PM
To: heroku/cli
Cc: Bill Long; Mention
Subject: Re: [heroku/cli] heroku login does not work with cygwin or git bash (#84)

This error shows up because it's not a tty. It shouldn't be a tty in cmdexe as long as you're calling it normally. Somehow you'll have to make it a tty just for the login. If nothing else you could set HEROKU_API_KEY to a valid API key and you won't need to login.

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub https://github.com/heroku/cli/issues/84#issuecomment-318424134 , or mute the thread https://github.com/notifications/unsubscribe-auth/AFSzkAH_PzRC0lI48fBVMCRBsv6B04EPks5sSMKIgaJpZM4GFQ14 . https://github.com/notifications/beacon/AFSzkAtSTUQFpdVFq3m5bwQ2flfU8Mrmks5sSMKIgaJpZM4GFQ14.gif

@eappleby solution works. I am using Windows 10. Would be nice to have it fixed in git bash though.

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.

@whindes After trying so many different configurations, this solution worked perfectly for me. Thank you! https://chocolatey.org/packages/heroku-cli/6.13.5

@eappleby solution worked for me too. I'm using CMDER, so I opened up a CMD tab and did heroku login, opened up another tab with Git Bash and was able to push correctly. PIA

Nice tricks - now work well - but the core should work anyway (This is a very weird + unclear error) - I hope in the future will be build-in solution (Most users install Git without changing preferences)

I still cant login
image

I had the same issue. For me it didn't work in the Git Bash, so I just used the standard Windows 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.

the new login will not have this issue as it does not prompt for a password. It should be GA in a few weeks, but for now you can switch to it with heroku update beta && heroku login

fatal: 'heroku' does not appear to be a git repository
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

edmorley picture edmorley  Â·  3Comments

rpsadarangani picture rpsadarangani  Â·  5Comments

dking74 picture dking74  Â·  7Comments

zeke picture zeke  Â·  7Comments

omarcostahamido picture omarcostahamido  Â·  4Comments