Can I use gcloud in Git Bash on Windows?

前端 未结 4 1326
遥遥无期
遥遥无期 2021-02-12 16:03

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

相关标签:
4条回答
  • 2021-02-12 16:33

    Create ~/.bashrc with one and only line:

    alias gcloud="gcloud.cmd"
    

    and restart you shell session. That's it.

    0 讨论(0)
  • 2021-02-12 16:39

    Another option - copying the gsutil and bq files from Linux version to /google-cloud-sdk/bin on Windows.

    0 讨论(0)
  • 2021-02-12 16:53

    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

    0 讨论(0)
  • 2021-02-12 16:54

    Put the following in a .bashrc file which should be located in C:\Users\YourWindowsAccount:

    gcloud() {
        "gcloud.cmd" "$@"
    }
    export -f gcloud
    

    Adapted from: https://askubuntu.com/a/98791

    Restart Git Bash thereafter.

    This solution is better than using aliases because it allows you to call gcloud from a shell script also.

    0 讨论(0)
提交回复
热议问题