HOMEBREW_VERSION: 0.9.8
ORIGIN: git://mobile.mirrors.ustc.edu.cn/homebrew.git
HEAD: 53c50891d96c85a3f5ce6fc2acc9e1c6d7905d65
Last commit: 8 days ago
Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
Core tap HEAD: 52d8a870fe7c10e3aa57ee30ef0a8cd523cd17ca
Core tap last commit: 74 minutes ago
# check whether the user has installed the homebrew
which -s brew
if [[ $? != 0 ]] ; then
# Tip user to install Homebrew
echo “Go to the page for installation: http://brew.sh/”
else
echo “You can use the USTC mirror to speed up Homebrew”
fi
# set the git origin to ustc mirror
echo “We have different ISP lines”
echo “and you can choose best one for you:”
echo “cernet, telecom, mobile, ipv4, ipv6″
ustc_mirror_domain=”mirrors.ustc.edu.cn”
default_url=””
# uncomment the line below and change the the ISP
# don’t forget the dot!!
#ISP=”mobile.”
# test whether user use the diff ISP
if [ -z ${var} ]; then
default_url=”${ISP}${ustc_mirror_domain}”
else
default_url=ustc_mirror_domain
fi
# test the script
#echo $default_url
#exit
# set the brew.git
cd /usr/local
git remote set-url origin “git://${default_url}/brew.git”
# test the script
#pwd
#echo “git://${default_url}/brew.git”
#exit
# set the homebrew-core.git
cd /usr/local/Library/Taps/homebrew/homebrew-core
git remote set-url origin “git://${default_url}/homebrew-core.git”
# set the homebrew-bottles
bottles_mirror_url=”https://${default_url}/homebrew-bottles”
echo “export HOMEBREW_BOTTLE_DOMAIN=${bottles_mirror_url}” >> ~/.bashrc
echo “”
echo “You have succeed set the USTC mirror for Homebrew!”
echo “We have lots of mirror of other project”
echo “You can go to the http://mirrors.ustc.edu.cn/ for more info”
echo “Enjoy the speed.”
exit
使用中出现了错误。
下面第一个为使用镜像,第二个为使用官方的。
HOMEBREW_VERSION: 0.9.8
ORIGIN: git://mobile.mirrors.ustc.edu.cn/homebrew.git
HEAD: 53c50891d96c85a3f5ce6fc2acc9e1c6d7905d65
Last commit: 8 days ago
Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
Core tap HEAD: 52d8a870fe7c10e3aa57ee30ef0a8cd523cd17ca
Core tap last commit: 74 minutes ago
HOMEBREW_VERSION: 0.9.9
ORIGIN: https://github.com/Homebrew/brew.git
HEAD: b70e4341fe1a217d51f2bf75b5e2fdb1f4e602d9
Last commit: 13 hours ago
Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
Core tap HEAD: 52d8a870fe7c10e3aa57ee30ef0a8cd523cd17ca
Core tap last commit: 2 hours ago
我的解决方案仅仅从错误中回复到原来的设置:
cd usr/local
git remote set-url origin git://github.com/Homebrew/homebrew.git
delete export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles in ~/.bashrc
cd usr/local
git reset –hard origin/master
希望有些帮助,并希望早日改正mirror的同步问题。
您好,我在本机使用USTC Homebrew源、Homebrew Bottles源没能重现问题。能否请您在故障状态下运行brew doctor,将结果贴出来。
你好,我说一下我的经过:
我大概一个月前使用homebrew,然后发现科大有mirror,就设置了,一切没问题。
直到大概上周发现无法更新后,便换回官方的repository。
昨天看到已经修复的通知,便改回了科大的mirror,使用brew update就出现了unmerged 的文件。
我遇到的问题大概和这个东西类似并且我的rep里有unmerged的文件:
https://github.com/Homebrew/legacy-homebrew/issues/8244
出现很多很多Library/Aliases/*文件
使用他的方法:
cd usr/local
git reset –hard origin/master
就会得到:
HOMEBREW_VERSION: 0.9.8
然而最新到了0.9.9
我以为是你们还没同步到最新的commit呢。
如果现在的没问题就好了,我还等着切到科大的mirror,谢谢你们的工作!
至于故障下的error我运行过doctor但是terminal里的缓存已经被清了,没找到。
我是担心其他人会和我一样的情况,所以才写的。
这似乎是官方升级脚本的一个bug,我发现科大源上docker中的homebrew也遇到了这个问题。我自己的MacBook可能更新得比较晚,没有遇到这个问题。
您可以尝试切换回科大源试试,我这边测试是正常的。如果遇到故障,请随时反馈~
公司的电脑,今天更新后还是以前的问题,看了一下可能是这个问题:
HOMEBREW_VERSION: 0.9.9
ORIGIN: https://github.com/Homebrew/brew.git
但使用科大的好像是4天前的commit。就是说可能core虽然更新到最新,但brew.git并不是最新的,总是晚几天(上次的版本错是也是因为没同步到最新)。
下面是错误描述:
Unmerged paths:
(use “git add …” to mark resolution)
added by us: Library/Aliases
added by us: Library/Formule
Untracked files:
(use “git add …” to include in what will be committed)
Library/Aliases~HEAD
Library/Formula~HEAD
感谢反馈,问题已确认。
git://mirrors.ustc.edu.cn/homebrew.git是旧的镜像,更新过程中会自动将上游地址设置为https://github.com/Homebrew/brew.git。但如果此时强行set-url至git://mirrors.ustc.edu.cn/homebrew.git,则会由于本地与远程仓库之间没有共同的祖先而合并失败。
解决方法:设置为新的仓库(git://mirrors.ustc.edu.cn/brew.git)即可。
你好,谢谢你们的维护,我已经切换到科大的镜像,没有什么问题了,一切正常,谢谢!
一个小建议,是否可以把设置mirror的东西写一个脚本,放在一起,尤其是brew.git和homebrew-core.git。这样就可以运行一个脚本,就可以用上了mirror。至于homebrew-bottles放在一起也好。
Bash script by Bambooin:
#!/bin/bash
# Author: Bambooin Date:2016.04.18
# check whether the user has installed the homebrew
which -s brew
if [[ $? != 0 ]] ; then
# Tip user to install Homebrew
echo “Go to the page for installation: http://brew.sh/”
else
echo “You can use the USTC mirror to speed up Homebrew”
fi
# set the git origin to ustc mirror
echo “We have different ISP lines”
echo “and you can choose best one for you:”
echo “cernet, telecom, mobile, ipv4, ipv6″
ustc_mirror_domain=”mirrors.ustc.edu.cn”
default_url=””
# uncomment the line below and change the the ISP
# don’t forget the dot!!
#ISP=”mobile.”
# test whether user use the diff ISP
if [ -z ${var} ]; then
default_url=”${ISP}${ustc_mirror_domain}”
else
default_url=ustc_mirror_domain
fi
# test the script
#echo $default_url
#exit
# set the brew.git
cd /usr/local
git remote set-url origin “git://${default_url}/brew.git”
# test the script
#pwd
#echo “git://${default_url}/brew.git”
#exit
# set the homebrew-core.git
cd /usr/local/Library/Taps/homebrew/homebrew-core
git remote set-url origin “git://${default_url}/homebrew-core.git”
# set the homebrew-bottles
bottles_mirror_url=”https://${default_url}/homebrew-bottles”
echo “export HOMEBREW_BOTTLE_DOMAIN=${bottles_mirror_url}” >> ~/.bashrc
echo “”
echo “You have succeed set the USTC mirror for Homebrew!”
echo “We have lots of mirror of other project”
echo “You can go to the http://mirrors.ustc.edu.cn/ for more info”
echo “Enjoy the speed.”
exit