windows
1.官方网站下载git 地址:https://git-scm.com/downloads
网速慢可以使用国内镜像https://pan.baidu.com/s/1kU5OCOB#list/path=%2Fpub%2Fgit
2.安装完成后,在开始菜单里找到“Git”->“Git Bash”,蹦出一个类似命令行窗口的东西,就说明Git安装成功!
3.安装完成后,输入你的名字和邮箱:
$ git config --global user.name "Your Name"
$ git config --global user.email "email@example.com"
4.注意git config命令的–global参数,用了这个参数,表示你这台机器上所有的Git仓库都会使用这个配置,当然也可以对某个仓库指定不同的用户名和Email地址。
linux
# 安装
yum -y install git
# 查看版本号
git --version
# 删除git
yum -y remove git
设置用户名和email
[root]# git config --global user.name “xxx”
[root]# git config --global user.email “xxx@qq.com”
此时$HOME目录下会新建一个.gitconfig文件
为github账号添加SSH keys
ssh-keygen -t rsa -C “xxx@qq.com”
系统会提示key的保存位置(一般是~/.ssh目录)和指定口令,保持默认,连续三次即可
然后打开id_rsa.pub文件,粘贴到github账号管理的添加SSH KEY界面中
cat ~/.ssh/id_rsa.pub