【问题标题】:Unable to access raw.githubusercontent.comUnable to access raw.githubusercontent.com
【发布时间】:2022-12-27 16:44:12
【问题描述】:

I want to download some files in github by raw.githubusercontent.com.

When using golang to implement this function, I encountered the following error:

dial tcp: lookup raw.githubusercontent.com: getaddrinfow: The requested name is valid, but no data of the requested type was found.

My code:

url1 := "https://raw.githubusercontent.com/pupillord/tiny-cs/main/README.md"

// the error mentioned above will appear here
resp, err := http.Get(url1)

Note: If I open it directly on the website, I can access the file normally.

【问题讨论】:

标签: go


【解决方案1】:

This error message is associated with the Winsock WSANO_DATA error code. It means, there is some problem with DNS record of the domain name you are trying to connect to.

See here : https://learn.microsoft.com/en-us/windows/win32/winsock/windows-sockets-error-codes-2#WSANO_DATA

  1. I think restarting server might fix it.
  2. you should investigate your environment's DNS settings
  3. If you manually entered the addres, make sure that the spelling is correct
  4. try entering the URL manually

【讨论】:

  • I checked your suggestion. There is really a problem with DNS. Thanks for your help !!!
【解决方案2】:

Looks like it was indeed a DNS issue. On macOS, by going to Settings > Network > Click Lock icon on the bottom left corner and authenticated > Advanced > and changing the DNS to 8.8.8.8 worked for me!

【讨论】:

    猜你喜欢
    • 2022-12-26
    • 2023-01-06
    • 1970-01-01
    • 2022-11-20
    • 2022-12-01
    • 2020-02-09
    • 1970-01-01
    • 2022-12-02
    • 2022-12-27
    相关资源
    最近更新 更多