homebrew安装问题(Failed during: git fetch origin master:refs/remotes/origin/master --tags --force)
在mac系统中,使用homebrew可以很方便的管理包。按照官网的说明执行以下命令时总是报错:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
应该是这个资源访问有问题,那么我们可以尝试使用国内的镜像。给大家推荐一个中国科学技术大学的镜像站点,里面有各种资源:
https://mirrors.ustc.edu.cn/brew.git
言归正传,开始踩坑
第一步,获取install文件
把官网给的脚本拿下来
curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install >> brew_install
第二步,更改脚本中的资源链接,替换成中国科学技术大学的镜像
就是把这两句
BREW_REPO = “https://github.com/Homebrew/brew“.freeze
CORE_TAP_REPO = “https://github.com/Homebrew/homebrew-core“.freeze
更改为这两句
BREW_REPO = “https://mirrors.ustc.edu.cn/brew.git “.freeze
CORE_TAP_REPO = “https://mirrors.ustc.edu.cn/homebrew-core.git“.freeze
当然如果这个镜像有问题的话,可以换成别的
第三步,执行脚本
/usr/bin/ruby brew_install
然后可以看到这几句:
==> Tapping homebrew/core
Cloning into '/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core'...
fatal: unable to access 'https://github.com/Homebrew/homebrew-core/': LibreSSL SSL_read: SSL_ERROR_SYSCALL, errno 54
Error: Failure while executing: git clone https://github.com/Homebrew/homebrew-core /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core --depth=1
Error: Failure while executing: /usr/local/bin/brew tap homebrew/core
liyuanbadeMacBook-Pro:~ liyuanba$ git clone https://github.com/Homebrew/homebrew-core /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core --depth=1
出现这个原因是因为源不通,代码来不下来,解决方法就是更换国内镜像源:
执行下面这句命令,更换为中国科学技术大学的镜像:
git clone git://mirrors.ustc.edu.cn/homebrew-core.git/ /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core --depth=1
就下载成功了
然后把homebrew-core的镜像地址也设为中国科学技术大学的国内镜像
cd "$(brew --repo)"
git remote set-url origin https://mirrors.ustc.edu.cn/brew.git
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git
执行更新,成功:
brew update
最后用这个命令检查无错误:
brew doctor
这样海外和已经有系统全局代理设置的朋友们就可以直接使用 brew 命令安装软件了。
接着换源:
直接使用 Homebrew 还需要更改默认源,不然谁用谁想打人,原因你懂的。以下是将默认源替换为国内 USTC 源的方法。
替换核心软件仓库
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git
替换 cask 软件仓库(提供 macOS 应用和大型二进制文件)
cd "$(brew --repo)"/Library/Taps/caskroom/homebrew-cask
git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-cask.git
替换 Bottles 源(Homebrew 预编译二进制软件包)
bash(默认 shell)用户:
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.bash_profile
source ~/.bash_profile
zsh 用户:
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.zshrc
source ~/.zshrc
基本用法:
假定操作对象为 wget,请替换为自己需要的软件包名
操作 命令
更新 Homebrew brew update
更新所有安装过的软件包 brew upgrade
更新指定的软件包 brew upgrade wget
查找软件包 brew search wget
安装软件包 brew install wget
卸载软件包 brew remove wget
列出已安装的软件包 brew list
查看软件包信息 brew info wget
列出软件包的依赖关系 brew deps wget
列出可以更新的软件包 brew outdated
参考:
Homebrew 中文主页
https://brew.sh/index_zh-cn.html
Homebrew Bottles 源使用帮助
http://mirrors.ustc.edu.cn/help/homebrew-bottles.html
Homebrew Cask 源使用帮助
http://mirrors.ustc.edu.cn/help/homebrew-cask.git.html
Homebrew Core 源使用帮助
http://mirrors.ustc.edu.cn/help/homebrew-core.git.html
---------------------
作者:QC班长
来源:CSDN
原文:https://blog.csdn.net/qq_35624642/article/details/79682979
版权声明:本文为博主原创文章,转载请附上博文链接!
homebrew安装问题(Failed during: git fetch origin master:refs/remotes/origin/master --tags --force)的更多相关文章
- 【Mac】安装 Homebrew 出错 Failed during: git fetch origin master:refs/remotes/origin/master --tags --force
今天在 Mac 装 Homebrew 遇到了一个问题,在网上找了大量解决方案,做个总结. Mac 版本 High Sierra 10.13.6. 问题描述 在 Mac 终端输入了 Homebrew 官 ...
- homebrew update 出现Failure while executing: git pull --quiet origin refs/heads/master:refs/remotes/origin/master解决方案
具体可以参考https://github.com/Homebrew/homebrew/issues/21002 cd /usr/local git status git reset --hard or ...
- git问题 next fetch will store in remotes/origin
项目在git的下无法查找到需要的Branch
- Git Push:error: Couldn't set refs/remotes/origin/master;error: update_ref failed for ref 'refs/remot
作者:荒原之梦 原文链接:http://zhaokaifeng.com/?p=543 今天使用Git Push代码时产生错误: Rename from 'XXXX/.git/refs/remotes/ ...
- 项目记事【Git】:git pull 出错 error: cannot lock ref 'refs/remotes/origin/feature/hy78861': is at d4244546c8cc3827491cc82878a23c708fd0401d but expected a6a00bf2e92620d0e06790122bab5aeee01079bf
今天 pull 代码的时候碰到以下问题(隐去了一些公司敏感信息): XXX@CN-00012645 MINGW64 /c/Gerrard/Workspace/XXX (master) $ git pu ...
- error: cannot lock ref 'refs/remotes/origin/master': unable to resolve reference 'refs/remotes/origin/master': reference broken...
之前在自己的项目中添加了一个分支,然后做了一些操作,比如同步本地的分支情况到远程仓库中,然后在远程仓库中完成分支合并,以及 Pull request 等等操作,后来,在本地仓库中进行 git fetc ...
- bad object refs/remotes/origin/HEAD
How to handle git gc fatal: bad object refs/remotes/origin/HEAD error: failed to run repack I random ...
- Git Pull Failed: cannot lock ref 'refs/remotes/origin/xxxxxxxx': unable to resolve ref
1.xxxxxxxx代表目录名称,我要pull的目录是supman_creditmall_v5: 2.从代码库中pull代码时报这个错误,代码pull失败: 3.解决办法,看下图,删除文件后再pull ...
- git fetch和git pull之间的区别--转载
原文地址:http://blog.csdn.net/a19881029/article/details/42245955 git fetch和git pull都可以用来更新本地库,它们之间有什么区别呢 ...
随机推荐
- 网络编程之Socket代码实例
网络编程之Socket代码实例 一.基本Socket例子 Server端: # Echo server program import socket HOST = '' # Symbolic name ...
- Oracle 实用SQL
start with connect by prior 递归查询用法 select * from 表名 aa start with aa.id = 'xxx' connect by prior aa. ...
- [币严区块链]以太坊(ETH)Dapp开发入门教程之宠物商店领养游戏
阅读本文前,你应该对以太坊.智能合约有所了解,如果你还不了解,建议你先看以太坊是什么 除此之外,你最好还了解一些HTML及JavaScript知识. 本文通过实例教大家来开发去中心化应用,应用效果如图 ...
- [币严BIZZAN区块链]数字货币交易所钱包对接之比特币(BTC)
在币严BIZZAN开发数字货币交易所的过程中,一共有两大难点,一个是高速撮合交易引擎,另一个是钱包对接,这两者是我们团队以前没有接触过的.这个系列的文章主要介绍数字货币交易所钱包对接实现技术.第一个要 ...
- .Net基础篇_学习笔记_第三天_Convert类型转换
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.T ...
- Mybatis值ResultMap的使用详解
Mybatis的定义 MyBatis 是一款优秀的持久层框架,它支持定制化 SQL.存储过程以及高级映射.MyBatis 避免了几乎所有的 JDBC 代码和手动设置参数以及获取结果集.MyBatis ...
- 企业及监控zabbix
Php要求必须是5.4及以上(centos 7默认是 5.4.16可以) #安装依赖库 yum -y install gcc curl curl-devel net-snmp net-snmp-dev ...
- CentOS7升级OpenSSL到1.1.1
首先下载解压最新的 OpenSSL wget https://github.com/openssl/openssl/archive/OpenSSL_1_1_1-stable.zip unzip Ope ...
- 利用kubeadm快速部署 kubernetes 集群
结合一下两个教程 https://www.cnblogs.com/along21/p/10303495.html 链接:https://pan.baidu.com/s/1O_pcywfso4VFOsF ...
- Winform组合ComboBox和TreeView实现ComboTree
最近做Winform项目需要用到类似ComboBox的TreeView控件. 虽然各种第三方控件很多,但是存在各种版本不兼容问题.所以自己写了个简单的ComboTreeView控件. 下图是实现效果: ...