还是不知道写啥,本文是有关Mac OS上Git与GitHub相关配置的介绍说明
安装git
该命令也可以升级最新的git
brew install git
查看git指向和版本信息
which git
/usr/bin/git
git --version
git version 2.21.0 (Apple Git-122.2)
配置github用户名和邮箱
git config --global user.name "ArithmeticJia"
git config --global user.email "1097197237@qq.com"
生成ssh密钥
ssh-keygen -t rsa -C "1097197237@qq.com"
Generating public/private rsa key pair.
Enter file in which to save the key (/Users/Arithmetic/.ssh/id_rsa):
/Users/Arithmetic/.ssh/id_rsa already exists.
Overwrite (y/n)? y
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /Users/Arithmetic/.ssh/id_rsa.
在GitHub上新增ssh密钥
复制密钥
cat .ssh/id_rsa.pub
路径一般是
/User/ArithmeticJia/.ssh
登录GitHub(默认你已经注册了GitHub账号),添加ssh key,点击Settings,如图
链接验证
ssh -T git@github.com
Hi Arithmeticjia! You've successfully authenticated, but GitHub does not provide shell access.