目录:
- 安装git
- 创建ssh key、配置git
- 提交本地项目到GitHub
1、输入命令行:brew install git
–未安装homebrew,需安装homebrew
/usr/bin/ruby -e “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)”
遇到问题:下载brew很慢
解决方法:
一、获取 install 文件
把官网给的脚本拿下来
curl -fsSL
https://
raw.githubusercontent.com
/Homebrew/install/master/install
>> brew_install
二、更改脚本中的资源链接
这里我替换成清华大学的镜像,修改如下两句:
BREW_REPO = “
https://
github.com/Homebrew/bre
w
“.freeze
CORE_TAP_REPO = “
https://
github.com/Homebrew/hom
ebrew-core
“.freeze
更改为这两句
BREW_REPO = ”
https://
mirrors.ustc.edu.cn/bre
w.git
“.freeze
CORE_TAP_REPO = ”
https://
mirrors.ustc.edu.cn/hom
ebrew-core.git
“.freeze
也可以换成别家的。
三、运行脚本
/usr/bin/ruby brew_install
安装成功后,输入如下命令检查是否安装成功:
注,添加清华大学镜像源:
echo ‘export HOMEBREW_BOTTLE_DOMAIN=
https://
mirrors.tuna.tsinghua.edu.cn
/homebrew-bottles
‘>> ~/.bash_profile
source ~/.bash_profile
==> Tapping homebrew/core
Cloning into ‘/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core’…
fatal: unable to access ‘Homebrew/homebrew-core’: LibreSSL SSL_read: SSL_ERROR_SYSCALL, errno 54
Error: Failure while executing: git clone 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 Homebrew/homebrew-core /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core –depth=1
出现这个原因是因为源不通,代码来不下来,解决方法就是更换国内镜像源:
执行下面这句命令,更换为中科院的镜像:
git clone git://http://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 Index of /brew.git/
cd “$(brew –repo)/Library/Taps/homebrew/homebrew-core”
git remote set-url origin Index of /homebrew-core.git/
执行更新,成功:brew update
安装git:brew install git
检测git和brew安装是否成功:输入命令git/brew,如图
git:
brew:
2.