The error is actually pretty clear:
Could not resolve hostname github.com: Name or service not known
The point is, for a connection you need an IP address, so you first have to convert github.com to one. For that, programs use your OS' DNS resolver. If that resolver has an issue (which is often just temporary due to some network changes), you can't resolve names to IP addresses and this happens.
For verification, use host github.com which should also give you an error that it can't resolve the name. If that is not the case, retry using Git, the error could have been temporary or it could be something completely different.
Otherwise, try these steps:
- Use
ping -O 8.8.8.8. - If that works, try
host github.com 8.8.8.8, which should be able to resolve the name. - With the resolved IP address, try
ping -O <address>.
FYI, 8.8.8.8 is a public DNS server operated by Google with an easy to remember IP address. You could use any other, but you must know the IP address and not just the name.
The first step is to check that you generally can reach the internet. The second tries to resolve the name via the DNS server. The third one checks general connectivity to github.com. If all work, it's a strong indication the problem is not with github.com or the internet itself. Instead, it's something caused by your OS' DNS resolver or local network.
In many cases, disabling and re-enabling your network configuration will fix this. Alternatively, switch to a different network. In desperate cases, rebooting your machine to restart the network configuration service from scratch may be necessary, but that would indicate it's a bug in that service.