1、使用 brew 安装 git
brew install git
2、配置 ssh
ssh-kengen -t rsa -C “邮箱” (目的是两台机器之间传输不需要密码)
/Users/xiaojie/.ssh/id_rsa 密钥保存路径
Your identification has been saved in /Users/xiaojie/.ssh/id_rsa.
Your public key has been saved in /Users/xiaojie/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:JPjf77MOsTF18zVqeYUop3X8W2PAYA5Ir0ZzGlyFT3s xiaojiez@37degree.com
The key's randomart image is:
+---[RSA 2048]----+
| ...oo+ |
| ...o.+.oo . |
| . .=.o+.*o*.o|
| ..o* O E+++|
| .+S = .+ ++|
| .. . =. o +|
| . + . |
| o. |
| o=o |
+----[SHA256]-----+
查看密钥文件:cd /Users/xiaojie/.ssh/id_rsa —下一步-> more id_rsa.pub
3、将密钥放到 gitlab 上
profile settings —> SSH Keys —> Add SSH KEY
4、进行 git 代码的拉取
git clone git项目的 SSH 地址
5、拉取成功之后,默认是 master分支。