基础环境配置
git下载
git配置
https://git-scm.com/book/en/v2/Customizing-Git-Git-Configuration
完成git的安装之后,点击Git Bash Here,进入git命令终端。
输入如下命令配置用户名以及邮箱
# 修改用户名
$ git config --global user.name "your_username"
# 修改邮箱
$ git config --global user.email "your_email"
# 查看当前用户
$ git config user.name
# 查看邮箱
$ git config user.email
生成gitee和github的SSH Key
- 打开 git Bash,运行下面的命令,过程中直接按 Enter 就行
# github SSH Key
$ ssh-keygen -t rsa -C 'github邮箱号' -f ~/.ssh/id_rsa_github
# gitee SSH Key
$ ssh-keygen -t rsa -C 'gitee邮箱号' -f ~/.ssh/id_rsa_gitee
- 这时会在你的用户家目录(Window:C:\Users\windows账户名.ssh,Linux/Mac:~/.ssh)下生成以下文件:
github和gitee添加SSH KEY
(下面以gitee为例)
进入个人账户的设置目录:
需要注意的是,公钥一栏复制的时上述生成文件中的.pub文件的内容,即:id_rsa_gitee.pub(这里使用记事本打开)。
另外提示一下,gitee这里粘贴公钥之后,标题自动显示,github需要手动添加标题(这里的标题内容默认为生成对称秘钥使用的邮箱)。
配置config文件
进入.ssh目录下,新建config文件,打开 git Bash,运行下面的命令
$ cd ~/.ssh
$ touch config
$ vim config
输入以下内容:
# gitee
Host gitee.com
HostName gitee.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/id_rsa_gitee
# github
Host github.com
HostName github.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/id_rsa_github
输入wq保存退出即可!
测试配置
$ ssh -T git@gitee.com
Hi [your_account_name]! You've successfully authenticated, but GITEE.COM does not provide shell access.
$ ssh -T git@github.com
Hi [your_account_name]! You've successfully authenticated, but GitHub does not provide shell access.
出现上述结果就证明配置成功!
语雀文档地址
https://www.yuque.com/docs/share/7ce33b5d-5563-400e-991b-f4b71f6ad618?#