关于git添加远程库报错解决办法Could not resolve hostname gittest.com: Temporary failure in name resolution

你已经在本地创建了一个Git仓库后,又想在GitHub创建一个Git仓库,并且让这两个仓库进行远程同步,这样,GitHub上的仓库既可以作为备份,又可以让其他人通过该仓库来协作,真是一举多得。但是在命令行上创建新的存储库,有瑕疵。

{

  github上的提示用命令: git remote add origin https://github.com/用户名/库名.git

}

如果忽略这个fatal,继续:

{

git push -u origin master

}

ssh: Could not resolve hostname gittest.com: Temporary failure in name resolution
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

发现失败了。我一直以为问题出现在公钥上,再次重复,又失败!

于是想到了第一次报出的fatal,原来是origin存在,但是第一感觉是我的目的是创建origin,应该不是这块的问题。细想一下,origin是默认给的,相当于里面没有任何东西,于是我打算把默认的origin删掉,重新绑定。

{

  git remote rm origin

}

然后: git remote add origin https://github.com/用户名/库名.git,成功了!

原文地址:https://www.cnblogs.com/xiao-zhang-blogs/p/6601302.html