
Typically this error happens due to misconfigured network settings. Do you have a firewall or VPN or some other kind of non-standard network setup?
One thing to try, if you are technically comfortable doing so, is resetting your /etc/hosts file. There is a guide here: https://www.igeeksblog.com/how-to-reset-restore-hosts-file-to-its-original-version-in-mac-windows/