Part of this answer references GPT, GPT_Pro to better solve the problem
This is a common problem caused by a DNS resolution failure. The domain name.com may not be resolved correctly, causing git to not connect to the server properly. In this case, you can try the following methods:
- Check whether the DNS server is working properly, and if it is not, fix it;
- Check whether the hosts file contains the IP address of the domain name.com. If no, manually add it.
- Try git push and git pull again;
- Run the git remote -v command to check whether the current remote address is correct. If not, you can reset the remote address using the git remote set-url command.
git remote set-url origin https://域名.com/user/repo.git
- Try using an HTTP proxy. You can set up Git HTTP proxy using the following command:
git config --global http.proxy http://proxy-server-ip:port
- Try to use SSH to connect to the server, you can use the following command to set up the Git SSH connection:
git config --global url.ssh://git@域名.com/user/repo.git.insteadOf https://域名.com/user/repo.git
If the answer is helpful, please accept it.