Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I use gcloud in Git Bash on Windows?

Tags:

So, I've installed Git, Git Bash, Python2.7, and I've just installed the Google Cloud SDK per the official guide. Using Windows 10.

In cmd.exe, or the "Google Cloud SDK Shell", gcloud works fine.

Within Git Bash, however (the terminal that I prefer to use), gcloud returns the following output (screenshot).

enter image description here

echo $PATH in Git Bash does include the path to the Google SDK (highlighted here).

enter image description here

Am I missing something? Is there anything in $PATH that is possibly conflicting with gcloud, or did I misconfigure the path somehow?

I appreciate any insight.


UPDATE. Here is the output of env|grep PATH. I'm not sure what it tells me. Any other executable in the PATH is working (vagrant, conda, python, etc), but gcloud is not.

enter image description here

like image 887
ensminger Avatar asked Apr 25 '16 14:04

ensminger


People also ask

Where do I run gcloud commands?

Running gcloud CLI commands You can run gcloud CLI commands from the command line and from scripts and other automations—for example, when using Jenkins to automate Google Cloud tasks. Note: gcloud CLI reference documentation and examples use backslashes, \ , to denote long commands.

How to run Google Cloud SDK from Git Bash?

In cmd.exe, or the "Google Cloud SDK Shell", gcloud works fine. Within Git Bash, however (the terminal that I prefer to use), gcloud returns the following output (screenshot). echo $PATH in Git Bash does include the path to the Google SDK (highlighted here).

What is Git Bash and how do I use it?

Now that you have a basic idea of what Git Bash is, it’s also important to understand everything you can do with it. The app allows you to execute Linux commands, and run shell scripts, and it also allows you to navigate to text files and directories using the ls (list files) or cd (change directory) commands, or edit files using the vim command.

How to run Git and Linux commands in Windows?

Like macOS and Linux, operating systems already have a command-line terminal where you can run Git and Linux commands directly. But for Windows, you have the Windows command prompt, which is a non-Unix terminal. How can you run Git and Linux commands in Windows? Git Bash will do the trick.

What is the use of Git in Windows?

Git is a version control system for controlling changes in software development. Like macOS and Linux, operating systems already have a command-line terminal where you can run Git and Linux commands directly. But for Windows, you have the Windows command prompt, which is a non-Unix terminal.


2 Answers

Create ~/.bashrc with one and only line:

alias gcloud="gcloud.cmd"

and restart you shell session. That's it.

like image 168
cardinal-gray Avatar answered Sep 20 '22 13:09

cardinal-gray


You need to use the full file name i.e. gcloud.sh or gcloud.cmd. See the following question for more details:

Git Bash doesn't see my PATH

like image 43
Vilas Avatar answered Sep 19 '22 13:09

Vilas