azure-cli icon indicating copy to clipboard operation
azure-cli copied to clipboard

.msi install doesn't work with git-for-windows bash

Open v-iam opened this issue 9 years ago • 9 comments

Description

Installing the .msi (0.2.9) and issuing the az command in the bash shell that comes with https://git-for-windows.github.io gives the following error:

C:\Program Files\Python36\python.exe: No module named azure.cli.__main__; 'azure.cli' is a package and cannot be directly executed

Environment summary

Install Method: How did you install the CLI? (e.g. pip, interactive script, apt-get, Docker, MSI, nightly)
Answer here: Installed using the .msi.

CLI Version: What version of the CLI and modules are installed? (Use az --version)
Answer here:

azure-cli (2.0.6)

acr (2.0.4)
acs (2.0.6)
appservice (0.1.6)
batch (2.0.4)
cdn (0.0.2)
cloud (2.0.2)
cognitiveservices (0.1.2)
command-modules-nspkg (2.0.0)
component (2.0.4)
configure (2.0.6)
core (2.0.6)
cosmosdb (0.1.6)
dla (0.0.6)
dls (0.0.6)
feedback (2.0.2)
find (0.2.2)
interactive (0.3.2)
iot (0.1.5)
keyvault (2.0.4)
lab (0.0.4)
monitor (0.0.4)
network (2.0.6)
nspkg (3.0.0)
profile (2.0.4)
rdbms (0.0.1)
redis (0.2.3)
resource (2.0.6)
role (2.0.4)
sf (1.0.1)
sql (2.0.3)
storage (2.0.6)
vm (2.0.6)

OS Version: What OS and version are you using?
Answer here: Windows 10 Enterprise (1607)

Shell Type: What shell are you using? (e.g. bash, cmd.exe, Bash on Windows)
Answer here: Git Bash from https://git-for-windows.github.io

v-iam avatar May 24 '17 21:05 v-iam

Does it work in cmd.exe?

derekbekoe avatar May 24 '17 22:05 derekbekoe

Yes, it does. Sorry, should have mentioned.

v-iam avatar May 24 '17 22:05 v-iam

We don't officially support Git Bash. I would recommend using cmd.exe or if you'd like a *nix experience, Bash on Windows is available and the CLI can be installed with apt-get see this.

derekbekoe avatar May 26 '17 05:05 derekbekoe

Closing this issue as git-bash is not a supported shell for the CLI.

tjprescott avatar May 26 '17 16:05 tjprescott

I really wish this issue would be reopened. There are tons of people who use Git Bash in favor of WSL. There are still various issues with WSL, while Git Bash works natively and works well.

AshleyGrant avatar Oct 25 '17 14:10 AshleyGrant

I tried in windows 7 : git bash az.cmd --version

It worked.

whindes avatar Nov 02 '17 22:11 whindes

The issue is fundamentally not recognizing the .cmd execution extension in windows. Just alias it out in the git bash shell wiht "alias az='az.cmd'"

It's really annoying when we see very limited if any invested interest in understanding the actual problem. Many people including myself ran into this, so I figured I would solve it since I reverse engineered the problem for some other hacks.

Also, you really only need to pre-empt the login process using Windows Command Line or PowerShell.

rondemena avatar Jun 07 '18 13:06 rondemena

@rondemena. Thanks much.

benktesh avatar Jul 17 '19 12:07 benktesh

A good workaround that helped me: https://stackoverflow.com/a/47085659/1651761

ichandan16 avatar Aug 14 '19 16:08 ichandan16