0
Follow
0
View

git submit code with error "fatal: unable to access ': Could not resolve host: domain.com"

czmike 注册会员
2023-02-26 19:06

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:

  1. Check whether the DNS server is working properly, and if it is not, fix it;
  2. Check whether the hosts file contains the IP address of the domain name.com. If no, manually add it.
  3. Try git push and git pull again;
  4. 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
  1. 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
  1. 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.

daiyuanrui 注册会员
2023-02-26 19:06

The following answers are quoted from GPT-3 model, please use them wisely:

示例。

这种情况可能是DNS解析的问题,可以通过以下步骤来解决:

1. 检查域名解析是否正确,如果不正确则修改域名解析;

2. 尝试使用ip地址而不是域名访问git仓库来测试是否能够正常访问;

3. 在git客户端本地设置hosts文件,将域名解析指向正确的ip地址。

举个示例:

假设要访问的域名是example.com,域名对应的ip地址是192.168.1.1,则可以通过以下步骤来解决:

1. 打开本地的hosts文件,一般位于C:\Windows\System32\drivers\etc\hosts,在文件中加入如下内容:

192.168.1.1 example.com

2. 保存并重启本地的Git客户端软件。

3. 使用新的hosts文件即可正常访问git仓库。

Please accept my answer if it answers your question

dfzxdmy110 注册会员
2023-02-26 19:06
< div class = "md_content_show e397 data - v - 3967" = "" >

thank you still want to rely on human experience summary. GPT-3 big model and it lists the possibilities.

medicmagic 注册会员
2023-02-26 19:06

To solve this problem, you only need to set the network proxy.
Run the following command on the CLI:
git config --global --unset http.proxy
git config --global --unset https.proxy

About the Author

Question Info

Publish Time
2023-02-26 19:06
Update Time
2023-02-26 19:06

Related Question

一个npm/yarn项目可以依赖于一个尚未构建的git回购吗?

GIT Extensions and a separate working directory

使用SSH密钥提交签名Git失败[重复]

github上我在push代码后发现,上面有两个贡献者

.NET6 Razor Pages : Url.Page() works, but LinkGenerator.GetPathByPage() in a IHostedService returns null

如何恢复已删除的git分支被删除和重新创建?

使用服务帐户获取Github存储库信息的最佳方法

gitHub删除上游分叉后

Android13如何通过git下载编译?

GitHub根据注释自动写代码