簡體   English   中英

為什么終端命令在MacOS的/ etc / hosts中不使用主機IP?

[英]Why terminal command doesn't use hosts IP in /etc/hosts in MacOS?

我已經將DNS IP添加到/ etc / hosts中:$ cat / etc / hosts | grep -is googlesource

216.58.200.33   android.googlesource.com
216.58.200.33   android-review.googlesource.com
216.58.200.33   fuchsia.googlesource.com
216.58.200.33   googlesource.com
216.58.200.33   boringssl.googlesource.com
216.58.200.33   gerrit.googlesource.com
216.58.200.33   gerrit-review.googlesource.com
216.58.200.33   chromium.googlesource.com
216.58.200.33   kernel.googlesource.com
216.58.200.33   gwt.googlesource.com
216.58.200.33   code.googlesource.com
216.58.200.33   www.googlesource.com
216.58.200.33   go.googlesource.com
216.58.200.33   go-review.googlesource.com
216.58.200.33   cdn.googlesource.com

但是當我ping googlesource.com時,它也使用IP 74.125.204.82:

$ ping googlesource.com
PING googlesource.com (74.125.204.82): 56 data bytes
Request timeout for icmp_seq 0
Request timeout for icmp_seq 1
Request timeout for icmp_seq 2
Request timeout for icmp_seq 3
Request timeout for icmp_seq 4
Request timeout for icmp_seq 5
Request timeout for icmp_seq 6
Request timeout for icmp_seq 7
Request timeout for icmp_seq 8
^C
--- googlesource.com ping statistics ---
10 packets transmitted, 0 packets received, 100.0% packet loss

而且我使用git從googlesource.com克隆源代碼,但仍然失敗:

$ git clone https://skia.googlesource.com/skia.git
Cloning into 'skia'...
fatal: unable to access 'https://skia.googlesource.com/skia.git/': Failed to connect to skia.googlesource.com port 443: Operation timed out

為什么? 如何強制git使用/ etc / hosts中的IP來解析URL?

sudo killall -HUP mDNSResponder必需? (來源: https : //www.imore.com/how-edit-your-macs-hosts-file-and-why-you-would-want

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM