(mac和linux均可使用的软件安装控制)
1、设置镜像
export HOMEBREW_BREW_GIT_REMOTE="https://mirrors.ustc.edu.cn/brew.git"
export HOMEBREW_CORE_GIT_REMOTE="https://mirrors.ustc.edu.cn/homebrew-core.git"
2、安装
/bin/bash -c "$(curl -fsSL https://cdn.jsdelivr.net/gh/ineo6/homebrew-install/install.sh)"
3、添加镜像地址
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles/bottles' >> ~/.zprofile
source ~/.zprofile
4、配置环境变量
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"
source ~/.zprofile
5、查看版本 (安装成功)
brew -v
Homebrew 3.2.0
Homebrew/homebrew-core (git revision a9c69a1de2; last commit 2021-06-27)
1、安装
brew install git
2、配置环境变量
vim ~/.zshrc
export GIT=/opt/homebrew/Cellar/git/2.30.0
export PATH=$GIT/bin:$PATH
3、配置用户名和邮箱
查看用户名和邮箱
git config --global user.name
git config --global user.email
删除
git config --global --unset user.name
git config --global --unset user.email
设置 (设置即可,如上两个方法可用于修改和查看)
git config --global user.name “***” // 配置全局用户名
git config --global user.email “****@qq.com” // 配置全局邮箱
4、公钥(为了后续无需密码即可访问)
ssh-keygen -t rsa -C "邮箱地址"
结果(中途直接确认使用默认配置即可)
Generating public/private rsa key pair. Enter file in which to save the key (/Users/vane/.ssh/id_rsa): Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /Users/vane/.ssh/id_rsa. Your public key has been saved in /Users/vane/.ssh/id_rsa.pub. The key fingerprint is: SHA256:Lxf4CO8E3cBQ5H4VbpvN+x/UqQOijvJ83O4Jx2EOljc “此处为上步的邮箱”
查看密钥完整信息
cat /Users/vane/.ssh/id_rsa.pub
结果:
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDJx5qjIOefGWtHeGCpuv2e0StGa8L1XPgy64ti4CdnB5bDXoOFl9SXLCzG5nAjUys+GSAH4ztAPpdhkApnrSpBk+r5nn2kR1W+nD0HNbE9PznnKkLXIOtdVRI91S0VA018DYZqFIBoKKJ6hoQU4s7KNSdL5MQlPCP5+b6YFyViyu/dMcQF55B2CcLhEoguwMgQHci11gE8PrVmY2zL/f3KfK/hK23dUxbOngpWPT5VrI5fVJ3IdEYFiIjVPqqgfZiH/nbkkQD8HgnjxIQqSwrFy4tNReqAZbQR7QjSgM4MEd6DJs2bq+gFxN8QWXVurV4UPEFLhXhctEf3MC5/ele2lHyUoBsqTQA5zdij9frjoXcvnm9oZQ2vKzsmhWLeyhcznpZQxl/uWZWPZ3rDMFjHG8Cn/4eUx+xEvZDw9eLeKnvSpctecapLKQLJ07Z70/M9npNDuofW6bKWdk7rsUy0Ihm1S2SlPQ4+sWGmvG+dMY0pIv+cdB3rZBhJjU09DA8= “此处为上步的邮箱地址”
如上结果复制到gitee中生成配置即可(路径:个人主页——SSH公钥——添加公钥)
查看是否OK
ssh -T git@gitee.com
输入yes确认即可