一、安装git
1、首选需要安装 Homebrew
mac安装Homebrew教程
2、执行一条命令即可
brew install git
3、查看下 git 版本
git --version
二、常用命令
1、设置提交人名字
查看提交人名字和邮箱
superking@wangchaodeMacBook-Pro shardingsphere % git config user.namesupkingxsuperking@wangchaodeMacBook-Pro shardingsphere % git config user.emailsupkingx@gmail.com
设置全局提交人名字和邮箱
git config --global user.email "supkingx@gmail.com"git config --global user.name "supkingx"
单独设置当前工程的提交人和名字。
打开工程目录下的隐藏文件 .git 下面的文件 config,在里面配置如下信息。
[user]name = wangchaoemail = wc262944@ncarzone.com
三、使用SSH拉取代码
git config —global user.name “your_name”
git config —global user.email “your_email”
ssh-keygen -t rsa -C “YOUR_EMAIL@YOUREMAIL.COM”
将文件 /Users/用户名/.ssh/id_rsa.pub 打开
并将里面的公钥复制到github即可
