Kali linux"无法解析主机github.com"错误

时间:2016-05-04 22:30:53

标签: linux git github ssh

我正在尝试下载Discover Scripts并一直使用git clone https://github.com/leebaird/discover.git作为我的命令。运行后,它返回:

git clone https://github.com/leebaird/discover.git
Cloning into 'discover'...
remote: Counting objects: 4217, done.
remote: Compressing objects: 100% (34/34), done.
error: RPC failed; result=56, HTTP code = 200 | 445.00 KiB/s     
fatal: The remote end hung up unexpectedly
fatal: early EOF
fatal: index-pack failed

所以我主动改变我的代理:

<code>
export GIT_TRACE_PACKET=1
export GIT_TRACE=1
export GIT_CURL_VERBOSE=1</code>

这解决了围绕RPC失败错误的问题。但是,它现在会产生更多错误:

<code>
11:32:36.928104 git.c:348               trace: built-in: git 'clone' 'https://github.com/leebaird/discover.git'
Cloning into 'discover'...
11:32:36.931252 run-command.c:343       trace: run_command: 'git-remote-https' 'origin' 'https://github.com/leebaird/discover.git'
* Couldn't find host github.com in the .netrc file; using defaults
* Could not resolve host: github.com
* Closing connection 0
fatal: unable to access 'https://github.com/leebaird/discover.git/': Could not resolve host: github.com
</code>

所以我决定通过运行返回的&#39; ssh -v git@github.com来看看是否可以看到某种形式的更改:

<code>
OpenSSH_7.1p2 Debian-1, OpenSSL 1.0.2e 3 Dec 2015
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to github.com [192.30.252.121] port 22.
debug1: Connection established.
debug1: permanently_set_uid: 0/0
debug1: SELinux support disabled
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_rsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_7.1p2 Debian-1
debug1: Remote protocol version 2.0, remote software version libssh-0.7.0
debug1: no match: libssh-0.7.0
debug1: Authenticating to github.com:22 as 'git'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client chacha20-poly1305@openssh.com <implicit> none
debug1: kex: client->server chacha20-poly1305@openssh.com <implicit> none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ssh-rsa SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8
The authenticity of host 'github.com (192.30.252.121)' can't be established.
RSA key fingerprint is SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8.
Are you sure you want to continue connecting (yes/no)? y
Please type 'yes' or 'no': yes
Warning: Permanently added 'github.com,192.30.252.121' (RSA) to the list of known hosts.
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Trying private key: /root/.ssh/id_rsa
debug1: Trying private key: /root/.ssh/id_dsa
debug1: Trying private key: /root/.ssh/id_ecdsa
debug1: Trying private key: /root/.ssh/id_ed25519
debug1: No more authentication methods to try.
Permission denied (publickey).
</code>

我不确定为什么会这么困难所以我决定运行<code>git ls-remote --tags --heads https://github.com/leebaird/discover.git</code>返回

<code>
11:56:12.303328 git.c:348               trace: built-in: git 'ls-remote' '--tags' '--heads' 'https://github.com/leebaird/discover.git'
11:56:12.303504 run-command.c:343       trace: run_command: 'git-remote-https' 'https://github.com/leebaird/discover.git' 'https://github.com/leebaird/discover.git'
* Couldn't find host github.com in the .netrc file; using defaults
*   Trying 192.30.252.129...
* Connected to github.com (192.30.252.129) port 443 (#0)
* found 173 certificates in /etc/ssl/certs/ca-certificates.crt
* found 696 certificates in /etc/ssl/certs
* ALPN, offering http/1.1
* SSL connection using TLS1.2 / ECDHE_RSA_AES_128_GCM_SHA256
*    server certificate verification OK
*    server certificate status verification SKIPPED
*    common name: github.com (matched)
*    server certificate expiration date OK
*    server certificate activation date OK
*    certificate public key: RSA
*    certificate version: #3
*    subject: 
*    start date: Thu, 10 Mar 2016 00:00:00 GMT
*    expire date: Thu, 17 May 2018 12:00:00 GMT
*    issuer: C=US,O=DigiCert Inc,OU=www.digicert.com,CN=DigiCert SHA2 Extended Validation Server CA
*    compression: NULL
* ALPN, server accepted to use http/1.1
> GET /leebaird/discover.git/info/refs?service=git-upload-pack HTTP/1.1
Host: github.com
User-Agent: git/2.7.0.rc3
Accept: */*
Accept-Encoding: gzip
Accept-Language: en-US, *;q=0.9<code>
OpenSSH_7.1p2 Debian-1, OpenSSL 1.0.2e 3 Dec 2015
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to github.com [192.30.252.121] port 22.
debug1: Connection established.
debug1: permanently_set_uid: 0/0
debug1: SELinux support disabled
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_rsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_7.1p2 Debian-1
debug1: Remote protocol version 2.0, remote software version libssh-0.7.0
debug1: no match: libssh-0.7.0
debug1: Authenticating to github.com:22 as 'git'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client chacha20-poly1305@openssh.com <implicit> none
debug1: kex: client->server chacha20-poly1305@openssh.com <implicit> none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ssh-rsa SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8
The authenticity of host 'github.com (192.30.252.121)' can't be established.
RSA key fingerprint is SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8.
Are you sure you want to continue connecting (yes/no)? y
Please type 'yes' or 'no': yes
Warning: Permanently added 'github.com,192.30.252.121' (RSA) to the list of known hosts.
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Trying private key: /root/.ssh/id_rsa
debug1: Trying private key: /root/.ssh/id_dsa
debug1: Trying private key: /root/.ssh/id_ecdsa
debug1: Trying private key: /root/.ssh/id_ed25519
debug1: No more authentication methods to try.
Permission denied (publickey).
</code>
Pragma: no-cache

< HTTP/1.1 200 OK
< Server: GitHub Babel 2.0
< Content-Type: application/x-git-upload-pack-advertisement
< Transfer-Encoding: chunked
< Expires: Fri, 01 Jan 1980 00:00:00 GMT
< Pragma: no-cache
< Cache-Control: no-cache, max-age=0, must-revalidate
< Vary: Accept-Encoding
< X-GitHub-Request-Id: 816B5044:63D3:24D8C90:572A6F6D
< X-Frame-Options: DENY
< 
* Connection #0 to host github.com left intact
11:56:12.694695 pkt-line.c:80           packet:          git< # service=git-upload-pack
11:56:12.694739 pkt-line.c:80           packet:          git< 0000
11:56:12.694768 pkt-line.c:80           packet:          git< b720281168ab1a2fa63e15ba9b1fc5819b5469ce HEAD\0multi_ack thin-pack side-band side-band-64k ofs-delta shallow no-progress include-tag multi_ack_detailed no-done symref=HEAD:refs/heads/master agent=git/2:2.6.5+github-1402-g2d14f67
11:56:12.694804 pkt-line.c:80           packet:          git< b720281168ab1a2fa63e15ba9b1fc5819b5469ce refs/heads/master
11:56:12.694834 pkt-line.c:80           packet:          git< a9a3bfb12e794aec2173f284d06e00bc027286cd refs/heads/python-port
11:56:12.694862 pkt-line.c:80           packet:          git< 8845f38c2362e4af826bef120b5ef675cb3fc037 refs/heads/while
11:56:12.694890 pkt-line.c:80           packet:          git< 415748fe79d8afa04db841485d45ee09b391c35d refs/pull/10/head
11:56:12.694919 pkt-line.c:80           packet:          git< e4a4ace1b646f5eecf0979b23dcfaa9cad99e7a8 refs/pull/11/head
11:56:12.694947 pkt-line.c:80           packet:          git< e687e5209eb88f1d399bbe5f49f4fb7bf15f02d3 refs/pull/11/merge
11:56:12.694975 pkt-line.c:80           packet:          git< ac63fa4dc6a3691ba4cafb18ae171319670b27ef refs/pull/12/head
11:56:12.695003 pkt-line.c:80           packet:          git< a4662c5e0d8419f7d6d8f036f6dac5425b3f3eac refs/pull/13/head
11:56:12.695032 pkt-line.c:80           packet:          git< 290dd7fe5d6240bda4724046bf172117ab5719ec refs/pull/13/merge
11:56:12.695061 pkt-line.c:80           packet:          git< 9097dd68b67084f9fd58be2610e54a86fb2f1d74 refs/pull/14/head
11:56:12.695090 pkt-line.c:80           packet:          git< dcc617b590e4e1ed5d81d8083deba7b36ec8cd9f refs/pull/14/merge
11:56:12.695117 pkt-line.c:80           packet:          git< 861141f72780c52fdea9b417f7dbc839a470645f refs/pull/15/head
11:56:12.695145 pkt-line.c:80           packet:          git< 8a273ca9681b18aa7c6b4abdf3b07329054a343a refs/pull/16/head
11:56:12.695174 pkt-line.c:80           packet:          git< 80a004d8886058b9eb824e2d39a819326fdf8e3f refs/pull/17/head
11:56:12.695202 pkt-line.c:80           packet:          git< 671f12771eb6533dd1e3cb7e187be20c0d796178 refs/pull/18/head
11:56:12.695230 pkt-line.c:80           packet:          git< 373919d728d33a88bfbbd23bc6c872757cce1d26 refs/pull/19/head
11:56:12.695259 pkt-line.c:80           packet:          git< e81bbd5173498bbe51a8d0332a0579df59c9429d refs/pull/2/head
11:56:12.695288 pkt-line.c:80           packet:          git< 1cde0c822f6071b4d06fa42e4a2b5f4c935d7561 refs/pull/21/head
11:56:12.695316 pkt-line.c:80           packet:          git< 074f1802759598e28a778557e62e9e63a32a0574 refs/pull/23/head
11:56:12.695344 pkt-line.c:80           packet:          git< 942ae2ced384394ba10a932fec36ca278a03a663 refs/pull/24/head
11:56:12.695373 pkt-line.c:80           packet:          git< 88add15cdad81ffb08c04f0e30b579164b2250bb refs/pull/25/head
11:56:12.695401 pkt-line.c:80           packet:          git< a52cfe49f538fac410d84ec97e53d72f9f2f74dc refs/pull/28/head
11:56:12.695429 pkt-line.c:80           packet:          git< 5c8bf847b3cf5d8f12f6a1607e89c7a66be49adb refs/pull/28/merge
11:56:12.695458 pkt-line.c:80           packet:          git< 30ef6b83d5ccc831b97f6f3d2f74c794aaa0025e refs/pull/29/head
11:56:12.695488 pkt-line.c:80           packet:          git< e36d7317e29b9df3a2e8f8387a412b90ec8527ba refs/pull/3/head
11:56:12.695518 pkt-line.c:80           packet:          git< a5d38a2586213636c22710b2e0defe0c66148dc7 refs/pull/30/head
11:56:12.695546 pkt-line.c:80           packet:          git< b30e819ffd53c3885470e2de272496f11b13ab90 refs/pull/31/head
11:56:12.695574 pkt-line.c:80           packet:          git< c0aae953873700dad0720a1a3c9cb4f559b04dc9 refs/pull/32/head
11:56:12.695602 pkt-line.c:80           packet:          git< 7ea646a3ba7d1f77701459548475bdc0c6a92eba refs/pull/32/merge
11:56:12.695631 pkt-line.c:80           packet:          git< 5eb9c12c0ff7ef20f183e5fdcfbabb7ee56d6b6e refs/pull/33/head
11:56:12.695659 pkt-line.c:80           packet:          git< 61c72abf1ec71038f651e0474b9cf9673cf4eb44 refs/pull/37/head
11:56:12.695687 pkt-line.c:80           packet:          git< 271f20a93a24d170e3cefd9a4a2f860ac0dc4062 refs/pull/38/head
11:56:12.695716 pkt-line.c:80           packet:          git< 55622c2c5214b4fef6c531637083c9a8f9b6ab62 refs/pull/38/merge
11:56:12.695745 pkt-line.c:80           packet:          git< 987492d5f9ab2882d43121249da42a7e1a9fee9d refs/pull/54/head
11:56:12.695773 pkt-line.c:80           packet:          git< 291255f85134a44ed1ec7501034cd57baac64948 refs/pull/8/head
11:56:12.695801 pkt-line.c:80           packet:          git< 4e85022e6fad06b3ea24a710ab9963efe8b741b6 refs/pull/8/merge
11:56:12.695833 pkt-line.c:80           packet:          git< ae149358d66a3a91d13812fddbdbdc80607bbdcd refs/pull/9/head
11:56:12.695857 pkt-line.c:80           packet:          git< 0000
b720281168ab1a2fa63e15ba9b1fc5819b5469ce    refs/heads/master
a9a3bfb12e794aec2173f284d06e00bc027286cd    refs/heads/python-port
8845f38c2362e4af826bef120b5ef675cb3fc037    refs/heads/while
</code>

我不确定如何继续或如何修复我的设置以允许克隆。我只需要解决这个问题,这样我就可以下载并继续。

1 个答案:

答案 0 :(得分:2)

  1. 实际警告为Couldn't find host github.com in the .netrc file。所以你 CAN 解决&#34; github.com&#34; ......它只是先看看netrc。

  2. 您的第二个代码段中的 REAL 问题是:

    debug1: Trying private key: /root/.ssh/id_rsa debug1: Trying private key: /root/.ssh/id_dsa debug1: Trying private key: /root/.ssh/id_ecdsa debug1: Trying private key: /root/.ssh/id_ed25519 debug1: No more authentication methods to try. Permission denied (publickey).

  3. 以下是一些问题排查提示:

  4. 坦率地说,工作:git clone https://github.com/leebaird/discover.git

    这是我得到的,没有任何特殊标志或任何特殊配置:

    git clone https://github.com/leebaird/discover.git Cloning into 'discover'... remote: Counting objects: 4217, done. remote: Compressing objects: 100% (34/34), done. remote: Total 4217 (delta 18), reused 0 (delta 0), pack-reused 4183 Receiving objects: 100% (4217/4217), 25.15 MiB | 5.07 MiB/s, done. Resolving deltas: 100% (2855/2855), done.