Ash3317 Ash3317 - 3 years ago 152
Git Question

Heroku CLI commands are not recognized after installation

I have installed Heroku CLI and git. After installation, I restarted the command prompt. When I run git commands, those are recognized fine. But when I type Heroku commands such as

heroku version
, they are not recognized.

So I set the path variable to point to the Heroku installation. Now, Heroku commands are working but the git commands have become unrecognized.

What is the actual problem?

Here is the cmd prompt content.

Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.

C:\Users\Deva 5>git config --list
core.symlinks=false
core.autocrlf=true
core.fscache=true
color.diff=auto
color.status=auto
color.branch=auto
color.interactive=true
help.format=html
http.sslcainfo=C:/Program Files/Git/mingw64/ssl/certs/ca-bundle.crt
diff.astextplain.textconv=astextplain
rebase.autosquash=true
credential.helper=manager
user.email=****
user.name=****
core.repositoryformatversion=0
core.filemode=false
core.bare=false
core.logallrefupdates=true
core.symlinks=false
core.ignorecase=true
core.hidedotfiles=dotGitOnly
gui.wmstate=normal
gui.geometry=888x427+150+150 171 192

C:\Users\Deva 5>heroku version
'heroku' is not recognized as an internal or external command,
operable program or batch file.

C:\Users\Deva 5>heroku login
'heroku' is not recognized as an internal or external command,
operable program or batch file.

C:\Users\Deva 5>set path="C:\Program Files\Heroku\bin"

C:\Users\Deva 5>heroku version
heroku-cli: Updating to 6.13.1-7bcaf87... 11.6 MB/11.6 MB
heroku-cli/6.13.1-7bcaf87 (windows-x64) node-v8.2.1

C:\Users\Deva 5>git config --list
'git' is not recognized as an internal or external command,
operable program or batch file.

Answer Source
set path="C:\Program Files\Heroku\bin"

By doing that, you replaced your PATH variable to only contain that path. So you essentially broke everything else.

What you usually do is append or prepend the new path to the PATH variable, e.g. like this:

set PATH=%PATH%;C:\Program Files\Heroku\bin

The permanent solution would be to edit your Windows to include that path to the Heroku executables by default. See this question on SuperUser for more information and instructions: What are PATH and other environment variables, and how can I set or use them?

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download