当前位置:   article > 正文

curl: (7) Failed to connect to raw.githubusercontent.com port 443 after 4 ms: Couldn‘‘t connect to_获取授权失败: curl: (7) couldn't connect to server

获取授权失败: curl: (7) couldn't connect to server

安装homebrew发生错误:

curl: (7) Failed to connect to raw.githubusercontent.com port 443 after 4 ms: Couldn't connect to server

mac电脑通过homebrew安装java到开发环境,第一步就发生了错误
显示无法连接服务器

失败原因:
(1)网络问题:你的计算机可能无法访问外部网络,或者网络请求被防火墙或代理服务器阻止了。
(2)DNS污染或解析问题:在某些情况下,DNS服务器可能无法正确解析raw.githubusercontent.com域名,导致连接失败。

解决措施:

在https://www.ipaddress.com/中查找查询raw.githubusercontent.com的真实IP地址为
199.232.28.133

对应的ip:199.232.28.133

199.232.28.133 raw.githubusercontent.com
  • 1

添加到hosts文件中即可。


添加流程:

添加的时候可能显示无权限,要修改一下hosts文件的权限。

方式一:界面方式

1、快捷键command+shift+g定位到/private文件夹中 在这里插入图片描述
2、右键显示简介:
在这里插入图片描述
先点锁输入密码,然后改动权限变成读与写 最后添加即可。
同理hosts文件也这样,hosts文件在etc文件夹里面
3、将这一行加入hosts文件中即可

199.232.28.133 raw.githubusercontent.com
  • 1

4、最后输入密码安装成功
https://brew.sh/

下载命令行为网站中的,直接复制即可

在这里插入图片描述
还有两行命令也码上

   echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> /Users/yourname/.zprofile
   eval " $(/opt/homebrew/bin/brew shellenv)"  
  • 1
  • 2

方式二:命令行

直接修改hosts的权限

sudo chflags -hv noschg /etc/hosts 
  • 1

vim添加后锁死

sudo chflags uchg /etc/hosts

sudo chflags schg /etc/hosts
  • 1
  • 2
  • 3

后续

1、安装git

brew install git
  • 1

2、安装maven

brew install maven
  • 1

使用maven配置环境变量(参考jdk配置的就可以)

 我的是.zprofile,从安装的那两行代码行看
open ~/.zprofile
#maven
export M2_HOME=/opt/homebrew/Cellar/maven/3.9.8/libexec
 
export PATH=${PATH}:${M2_HOME}/bin
 
source ~/.zprofile

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9

验证结果

mvn -version
  • 1

3、安装Tomcat 8

brew install tomcat@8
  • 1

4、安装jdk
进入官网
在这里插入图片描述

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/从前慢现在也慢/article/detail/996916
推荐阅读
相关标签
  

闽ICP备14008679号