Google Cloud SDK配置 解决ERROR: Reachability Check failed问题

安装google cloud sdk的时候第一次需要初始化,而初始化的时候因为一些原因,
会报错:

Network diagnostic detects and fixes local network connection issues.
Checking network connection...done.                                                                                                                                                                               
ERROR: Reachability Check failed.
    Cannot reach https://www.google.com (ServerNotFoundError)
    Cannot reach https://accounts.google.com (ServerNotFoundError)
    Cannot reach https://cloudresourcemanager.googleapis.com/v1beta1/projects (ServerNotFoundError)
    Cannot reach https://www.googleapis.com/auth/cloud-platform (ServerNotFoundError)
    Cannot reach https://dl.google.com/dl/cloudsdk/channels/rapid/components-2.json (ServerNotFoundError)
Network connection problems may be due to proxy or firewall settings.
。

或者下面卡很久

Network diagnostic detects and fixes local network connection issues.
Checking network connection...

自己的电脑直接科学上网也不行,谷歌文档中是这么说的:
如果您位于公司代理或防火墙后面,gcloud 命令行工具可能无法使用默认设置访问互联网。

以下是正确配置google cloud sdk的方法,首先自己的电脑能够科学上网,其次通过以下三行配置sdk的proxy

config set proxy/type socks5
config set proxy/address 127.0.0.1
gcloud config set proxy/port 1080

以下是全部命令与流程

Welcome to the Google Cloud SDK! Run "gcloud -h" to get the list of available commands.
---

D:\Programming\Tools\cloud\google_cloud\cloud_sdk>gcloud config set proxy/type socks5
Updated property [proxy/type].

D:\Programming\Tools\cloud\google_cloud\cloud_sdk>gcloud config set proxy/address 127.0.0.1
Updated property [proxy/address].

D:\Programming\Tools\cloud\google_cloud\cloud_sdk>gcloud config set proxy/port 1080
Updated property [proxy/port].

D:\Programming\Tools\cloud\google_cloud\cloud_sdk>gcloud init
Welcome! This command will take you through the configuration of gcloud.

Settings from your current configuration [proxyconfig0] are:
core:
  disable_usage_reporting: 'False'
proxy:
  address: 127.0.0.1
  port: '1080'
  type: socks5

Pick configuration to use:
 [
  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 6
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 6
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值