Mac系统下载git踩坑-homebrew安装失败以及git clone失败的问题

homebrew安装失败

首先要下载 安装homebrew。
踩坑一:官方文档给出的代码:

/bin/bash -c "$(curl -fsSL https://cdn.jsdelivr.net/gh/ineo6/homebrew-install/install.sh)"

直接在终端中运行会报错,在这里插入图片描述
解决方法:
配置hosts文件,目录在 /private/etc/hosts

https://www.ipaddress.com 在这个网站中查找 raw.githubusercontent.com 的IP地址,显示有4个,就将这四个都写在hosts 文件中。

在这里插入图片描述

# GitHub raw & imag
185.199.108.133 raw.githubusercontent.com
185.199.109.133 raw.githubusercontent.com
185.199.110.133 raw.githubusercontent.com
185.199.111.133 raw.githubusercontent.com

系统的 hosts 文件是不能够进行修改的,可以先保存一个副本,对副本进行修改,再将副本替换为 hosts 文件。

git clone 失败的问题

git 克隆代码出错,解决方式:

git config --global http.proxy socks5://localhost:1080
git config --global https.proxy socks5://localhost:1080

需要将http 和 https 代理设置一下

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值