gCloud SDK无法在公司代理后面的macOS中安装

问题描述 投票:0回答:1

我正在尝试安装gcloud SDK,同时使用一个在代理(有时是VPN)后面工作的公司网络。我使用pac.fcgi文件(自动代理配置)自动获取代理设置。

现在,当我尝试在终端中运行./install.sh时,我不断收到以下错误

➜  google-cloud-sdk ./install.sh
Welcome to the Google Cloud SDK!

To help improve the quality of this product, we collect anonymized usage data
and anonymized stacktraces when crashes are encountered; additional information
is available at <https://cloud.google.com/sdk/usage-statistics>. You may choose
to opt out of this collection now (by choosing 'N' at the below prompt), or at
any time in the future by running the following command:

    gcloud config set disable_usage_reporting true

Do you want to help improve the Google Cloud SDK (Y/n)?  

ERROR: (gcloud.components.list) Failed to fetch component listing from server. Check your network settings and try again.

我发现this SO question有同样的问题,但他们的问题与ipv6有关。我已经禁用了ipv6(我甚至无法启用它),我使用以太网连接到网络。因此答案对我没用。

我搜索了有关安装的代理相关信息,并找到了this page。它要求使用非交互式安装程序,并在安装后使用gcloud命令设置代理。我的问题是我甚至无法安装gcloud。我尝试过交互式和非交互式安装程序。

任何方式我都可以在公司代理后面安装gcloud。

PS:我在macOS High Sierra上使用zsh shell(已经尝试过bash),以防万一。

proxy google-cloud-platform gcloud
1个回答
2
投票

所以,问题是我无法在安装gcloud之前设置代理。 gcloud的安装基本上将CLI设置在路径中并安装一些必需的组件(corebqgsutil等)。

所以我做的是在.zshrc中添加了以下几行

source <PATH to gcloud sdk>/google-cloud-sdk/path.zsh.inc
source <PATH to gcloud sdk>/google-cloud-sdk/completion.zsh.inc

或者如果您使用bash,请在.bashrc或.bash_profile中添加这些行

source <PATH to gcloud sdk>/google-cloud-sdk/path.bash.inc
source <PATH to gcloud sdk>/google-cloud-sdk/completion.bash.inc

之后我重新启动终端(或者在终端上运行source ~/.zshrcsource ~/.bashrcsource ~/.bash_profile

现在我能够使用gcloud命令。我运行gcloud init,设置代理,然后使用以下命令安装所需的组件 -

gcloud components install core bq gsutil

我没有使用gcloud脚本安装install.sh

PS:运行scutil --proxy以了解系统中设置的代理设置。

© www.soinside.com 2019 - 2024. All rights reserved.