"bash: aws: command not found" on Windows 7 in Git Bash
Asked Answered
S

4

6

I'm trying to use AWS CLI to access CodeCommit. And it's sort of working. I am able to use the aws command in the Windows command prompt. However, when I try to access it using the Git Bash shell, it says

"bash: aws: command not found."

Additionally, when I try to do do a git clone in the Windows command promt, trying to access CodeCommit, it tries to use aws using the credentials helper, which also results in "aws: command not found."

enter image description here

I followed the instructions in the AWS documentation, which suggests some directories to add to the PATH:

https://docs.aws.amazon.com/cli/latest/userguide/awscli-install-windows.html#awscli-install-windows-path

Here's what my PATH variable looks like:

C:\Users\ddrayton\AppData\Local\Programs\Python\Python36\Scripts\;C:\Users\ddrayton\AppData\Local\Programs\Python\Python36\;C:\Windows\System32;;C:\Program Files\Docker Toolbox;C:\Users\ddrayton\MyCurl;%USERPROFILE%\AppData\Local\Programs\Python\Python36\Scripts;C:\Program Files\Amazon\AWSCLI;C:\Program Files (x86)\Amazon\AWSCLI;C:\Users\ddrayton\AppData\Local\Programs\Python\Python36;C:\Users\ddrayton\AppData\Local\Programs\Python\Python36\Scripts

But I'm not sure if it's a PATH problem, since the Windows command prompt has no problem accessing the "aws" command.

Any ideas?

Sergu answered 26/10, 2018 at 20:5 Comment(0)
S
12

Fixed this by simply installing the AWS CLI again but this time using Git Bash instead of the Windows command prompt.

pip install awscli

If anyone could provide some insight as to why this was necessary, it would be appreciated.

Sergu answered 26/10, 2018 at 20:26 Comment(4)
This helped me. In my situation i even did not have pip installed. So I had to install Pithon, then use the pip command above. Thank you very much!Scrap
I should note that although this solution fixed my problem on one computer, it did NOT fix my problem on my other computer. :-(Sergu
It worked for me, i also faced same problem, aws command was working fine in command prompt but not in git bash.Bucovina
I didn't have to run pip install awscli I simply installed awscli via the windows UI installer and then restarted my code editor and terminal and it workedTieck
G
7

In my case, I think a recent-to-me update to the AWS CLI changed what's run to being aws.cmd (full path C:\Program Files\Amazon\AWSCLI\bin\aws.cmd)

Git Bash needs the extension aws.cmd to make it work.

In Bash, you could try typing aws.cmd vs aws. If the former works, but not the latter, you can do alias aws='aws.cmd' in your bash startup script. I don't know if it's the best solution, but it worked for me.

FWIW, I think it's related to this: https://unix.stackexchange.com/questions/280528/is-there-a-unix-equivalent-of-the-windows-environment-variable-pathext

Georganngeorge answered 5/2, 2019 at 15:57 Comment(0)
M
1

On Windows 10 I was installing just once from GitBash via pip install awscli --upgrade --user as described in AWS manual for CLI installation for Linux

It installed aws executables into %USERPROFILE%\AppData\Roaming\Python\Python37\Scripts

After that just add this folder to your PATH. Re-open GitBash or cmd - it should work from both places

Maighdlin answered 11/2, 2019 at 16:24 Comment(0)
D
0

In my case closing and reopening Git Bash made it work, but I was using Windows 10.

Dentition answered 9/7, 2024 at 13:17 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.