今天本地Git Push 代碼推送遠(yuǎn)程分支,提示如下錯(cuò)誤信息:
zzg@LAPTOP-8R0KHL88 MINGW64 /e/idea_workspace (master)
$ git push
ssh: Could not resolve hostname github.com: No address associated with hostname
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
Google 一下,大家的建議是重新配置ssh Key。
重新生成GitHub SSH Key 值,請(qǐng)參考如下指令
zzg@LAPTOP-8R0KHL88 MINGW64 /e/idea_workspace (master)
$ git config user.name
zhouzhiwengang
zzg@LAPTOP-8R0KHL88 MINGW64 /e/idea_workspace (master)
$ git config user.email
zhouzhiwengang@163.com
zzg@LAPTOP-8R0KHL88 MINGW64 /e/idea_workspace (master)
$ ssh-keygen -t rsa -C "zhouzhiwengang@163.com"
Generating public/private rsa key pair.
Enter file in which to save the key (/c/Users/zzg/.ssh/id_rsa):
/c/Users/zzg/.ssh/id_rsa already exists.
Overwrite (y/n)? y
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /c/Users/zzg/.ssh/id_rsa
Your public key has been saved in /c/Users/zzg/.ssh/id_rsa.pub
The key fingerprint is:
SHA256:ikXfYyRhWd/897SdPdU+Q/NKTgoZVFm4a4/4qzICidw zhouzhiwengang@163.com
The key's randomart image is:
+---[RSA 3072]----+
| oo. .+. |
| ... ooo |
| . . o ..o |
| . . = . ..|
| . o .. S = . o*|
| o Eo . . +o .o@|
| ... oo oo**|
| . o ...=..+|
| . o.o+.o |
+----[SHA256]-----+
zzg@LAPTOP-8R0KHL88 MINGW64 /e/idea_workspace (master)
$ eval $(ssh-agent -s)
Agent pid 909
zzg@LAPTOP-8R0KHL88 MINGW64 /e/idea_workspace (master)
$ ssh-add /c/Users/zzg/.ssh/id_rsa
Identity added: /c/Users/zzg/.ssh/id_rsa (zhouzhiwengang@163.com)
zzg@LAPTOP-8R0KHL88 MINGW64 /e/idea_workspace (master)
$ clip < /c/Users/zzg/.ssh/id_rsa.pub
執(zhí)行以上指令完成本機(jī)SSH Key值生成,并將生成的Key 拷貝至Git 賬戶/Setting/SSH key 設(shè)置。
溫馨提示:SSH Key 生成時(shí),會(huì)提示本地已經(jīng)存在是否覆蓋,選擇y,再Enter回車(chē)。
重新嘗試git 代碼推送
zzg@LAPTOP-8R0KHL88 MINGW64 /e/idea_workspace (master)
$ ssh -T git@github.com
ssh: Could not resolve hostname github.com: No address associated with hostname
錯(cuò)誤含義:域名解析無(wú)法找到GitHub.
Google 一下,大家的解決辦法時(shí),將GitHub IP地址配置至hosts文件。
解決Github 域名方法問(wèn)題:?
第一步:查詢(xún)Github 真實(shí)IP地址,可以通過(guò)?https://www.ipaddress.com/查詢(xún)。
?
?第二步:在本機(jī):C:\Windows\System32\drivers\etc\hosts 文件中,添加如下配置:文章來(lái)源:http://www.zghlxwxcb.cn/news/detail-471182.html
# Copyright (c) 1993-2009 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
# 102.54.94.97 rhino.acme.com # source server
# 38.25.63.10 x.acme.com # x client host
# localhost name resolution is handled within DNS itself.
# 127.0.0.1 localhost
# ::1 localhost
140.82.113.4 github.com
至此,我的Git代碼推送恢復(fù)正常。文章來(lái)源地址http://www.zghlxwxcb.cn/news/detail-471182.html
到了這里,關(guān)于Git提示:ssh: Could not resolve hostname github.com: No address associated with hostname的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!