Network connection problems in Google Cloud SDK while I have access to google or website like google app engine in my browser

风流意气都作罢 提交于 2020-05-27 09:43:15

问题


I created an account on Google App Engine, then I installed google-cloud-sdk by gcloud init, and get the following error:

Pick configuration to use:
 [1] Re-initialize this configuration [a] with new settings
 [2] Create a new configuration
 [3] Switch to and re-initialize existing configuration: [default]
Please enter your numeric choice:  1

Your current configuration has been set to: [a]

You can skip diagnostics next time by using the following flag:
  gcloud init --skip-diagnostics

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

Do you have a network proxy you would like to set in gcloud (Y/n)?  Y

Select the proxy type:
 [1] HTTP
 [2] HTTP_NO_TUNNEL
 [3] SOCKS4
 [4] SOCKS5
Please enter your numeric choice:  1

Enter the proxy host address: XXX

Enter the proxy port: XXX

Is your proxy authenticated (y/N)?  n

Cloud SDK proxy properties set.

Rechecking network connection...done.
ERROR: Reachability Check still does not pass.
    Cannot reach https://www.google.com (ResponseNotReady)
    Cannot reach https://accounts.google.com (ResponseNotReady)
    Cannot reach 
https://cloudresourcemanager.googleapis.com/v1beta1/projects 
(ResponseNotReady)
    Cannot reach https://www.googleapis.com/auth/cloud-platform 
(ResponseNotReady)
    Cannot reach 
https://dl.google.com/dl/cloudsdk/channels/rapid/components-2.json 
(ResponseNotReady)

Current effective Cloud SDK network proxy settings:
    type = http
    host = XXX
    port = XXX
    username = None
    password = None

What would you like to do?
 [1] Change Cloud SDK network proxy properties
 [2] Clear all gcloud proxy properties
 [3] Exit
Please enter your numeric choice:

I am in China but I can unblock google or website like google app engine in my browser with proxy(setting in shadowsocks2.3). I tried to set a network proxy in google cloud SDK, the IP address and port are exactly the one used in shadowsocks2.3, but it still didn’t work. And my project list couldn’t be accessed. What is the exact problem? Hints or explanations are all appreciated. Many thanks in advance!


回答1:


To set your host : 127.0.0.1 and port : 1080

I have ss in my computer.And when I set like above,it can work well.




回答2:


You need to configure your gcloud cli tool to use a proxy.

https://cloud.google.com/sdk/docs/proxy-settings

In my case, I'm using shadow-socks as proxy, so I did:

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

and it works.



来源:https://stackoverflow.com/questions/49595789/network-connection-problems-in-google-cloud-sdk-while-i-have-access-to-google-or

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!