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

heroku login does not work with cygwin or git bash #84

Closed
jdx opened this issue Sep 28, 2015 · 60 comments
Closed

heroku login does not work with cygwin or git bash #84

jdx opened this issue Sep 28, 2015 · 60 comments

Comments

@jdx
Copy link
Contributor

jdx commented Sep 28, 2015

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

@npalmius
Copy link

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

@shuckc
Copy link

shuckc commented Oct 13, 2015

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

@neosb
Copy link

neosb commented Oct 24, 2015

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

@cherchyk
Copy link

cherchyk commented Dec 4, 2015

Any update here?

@chroda
Copy link

chroda commented Dec 14, 2015

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

@shahwaiz90
Copy link

whats the solution?

@CMCDragonkai
Copy link

It works with ZSH. cygstart zsh.

@jkutner
Copy link
Contributor

jkutner commented Dec 26, 2015

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

@starrychloe
Copy link

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: starrychloe@mydomain.com
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>

@eappleby
Copy link

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.

@ransombriggs
Copy link

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

@npalmius
Copy link

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

@rbashish
Copy link

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

rbashish_heroku

rbashish_heroku_cmd

@ransombriggs
Copy link

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

@rbashish
Copy link

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

@velo
Copy link

velo commented Mar 27, 2016

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

@rbashish
Copy link

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

@ransombriggs
Copy link

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

@destenson
Copy link

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

@friendyogi
Copy link

Got this error when using Mobaxterm:-
image

When can I expect the fix?

@jdx
Copy link
Contributor Author

jdx commented May 6, 2016

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.

@ransombriggs
Copy link

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.

@iancampelo
Copy link

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

@kurleysams
Copy link

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.

@starrychloe
Copy link

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: starrychloe@example.com
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

@protrudamus
Copy link

protrudamus commented Jul 26, 2017

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?

@jdx
Copy link
Contributor Author

jdx commented Jul 26, 2017

@protrudamus try running winpty heroku login

@protrudamus
Copy link

protrudamus commented Jul 26, 2017 via email

@jdx
Copy link
Contributor Author

jdx commented Jul 27, 2017

use cmd.exe to login then

@protrudamus
Copy link

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

@jdx
Copy link
Contributor Author

jdx commented Jul 27, 2017

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.

@protrudamus
Copy link

protrudamus commented Jul 27, 2017 via email

@weidmaster
Copy link

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

@whindes
Copy link

whindes commented Sep 6, 2017

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.

@RMDern
Copy link

RMDern commented Sep 7, 2017

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

@JoshCrosby
Copy link

@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

@Ezra-Siton-UIX
Copy link

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)

rupav added a commit to rupav/badgeyay that referenced this issue Jan 28, 2018
For windows, on git bash, `heroku login` don't work, hence use `winpty heroku login`. Refer heroku/cli#84.
abishekvashok pushed a commit to fossasia/badgeyay that referenced this issue Jan 28, 2018
For windows, on git bash, `heroku login` don't work, hence use `winpty heroku login`. Refer heroku/cli#84.
rupav added a commit to rupav/query-server that referenced this issue Jan 28, 2018
For windows, on git bash, heroku login don't work, hence use winpty heroku login. Refer heroku/cli#84. Similar PR raised in badgeyay fossasia/badgeyay#531 .
ParthS007 pushed a commit to fossasia/query-server that referenced this issue Jan 28, 2018
For windows, on git bash, heroku login don't work, hence use winpty heroku login. Refer heroku/cli#84. Similar PR raised in badgeyay fossasia/badgeyay#531 .
@gocs
Copy link

gocs commented Jan 29, 2018

I still cant login
image

sagar-kalra pushed a commit to sagar-kalra/badgeyay that referenced this issue Feb 1, 2018
For windows, on git bash, `heroku login` don't work, hence use `winpty heroku login`. Refer heroku/cli#84.
@RegisStudios
Copy link

I had the same issue. For me it didn't work in the Git Bash, so I just used the standard Windows CMD.

@SlaWitDev
Copy link

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.

jdx pushed a commit that referenced this issue Jun 19, 2018
* add overview to topic

* fix failing test

* remove newline
@jdx
Copy link
Contributor Author

jdx commented Nov 1, 2018

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

@jdx jdx closed this as completed Nov 1, 2018
@Collinsifere
Copy link

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.

@avengerx
Copy link

It's been a long time... This issue is still there, right?

For me, what worked was to create ~/.netrc with the current login's auth token.

In my case, I installed heroku using windows installation of NPM (not cygwin's NPM or node client). But I called the non-cygwin NPM install from a cygwin shell, like this:

$ npm install --global heroku

Currently, and in my Node.JS install, there's some error report during install, related to finding Visual Studio (I do have community 2022 installed, so figures), but in the end the heroku command becomes available.

Then, proceed with:

heroku login # it will ask to open browser and log in. do it and the command should return automagically once login in browser proceeds
heroku auth:token # then copy the auth token shown to clipboard

Create ~/.netrc (it should be in your cygwin home, not windows one) replacing the auth token where <TOKEN> is imprinted:

machine api.heroku.com
  login heroku_token
  password <TOKEN>
machine git.heroku.com
  login heroku_token
  password <TOKEN>

It seems older versions of heroku used to create this file (7.60.2 at least?), so at some point between 2020 and now, the heroku client should have worked in cygwin.

With that, the git push/fetch worked without asking for credentials.

Important: You need to update the token in ~/.netrc every login.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests