一、首先我们需要安装Homebrew
M系列 Mac安装配置Homebrewhttps://blog.csdn.net/W_Fe5/article/details/134428377?spm=1001.2014.3001.5501
二、下载git
1、终端输入一下命令
bash
brew install git

2、这时下载完成

二、配置git
1、创建用户名和邮箱
这里以我自己的邮箱举例
bash
git config --global use.name "wf"
git config --global use.email "48399912@qq.com"

2、查看刚刚设置的用户名和邮箱
bash
git config use.name
git config use.email

3、创建ssh key(密钥)
①、ssh-keygen -t rsa -C "刚刚设置的邮箱",过程中一直回车,输入密码就可以了
bash
ssh-keygen -t rsa -C "刚刚设置的邮箱"
我们会看到这么一句话,告诉你的密钥存放的位置:
bash
Your public key has been saved in /Users/wf/.ssh/id_rsa.pub

②、现在通过终端输入我们的地标进入文件
bash
cd /Users/wf/.ssh

bash
ls //查看该文件下的所有文件
cat id_rsa.pub //显示文件内容
③、 我们可以看到一大串乱码,这些就是我们的密钥

4、配置GitHub
没有GitHub账号的话申请即可
①、我们打开Settings,我们找到SSH and GPG keys
②、设置密钥,将刚刚的密钥输入进去

③、Title------>自定义名字,Key------>添加终端中的密钥,添加完成后,我们点击"Add new SSH Key",登录账号
④、添加成功

⑤、 终端验证一下有没有链接到里面
bash
ssh -T git@github.com
他说你确定你想要进去链接吗, yes我们进去,输入密码回车
⑥、配置GitHub成功

如果出现这么一句话,你的用户名,你已经成功的被认证了,说明你这边已经连接到这个github已经成功了。
那么之后你可以在你的github上面去创建一个仓库,然后,或者说启动一个新的项目,然后在里面去填写一下你自己的这个项目的一个信息,那么你就可以将这个项目克隆到本地,就是复制这个项目的SSH这个地址,然后克隆到本地。那么你这个项目就可以在你的本地去进行一个协同的一个开发了