# 通过以下语句查看设置的账户信息
$ git config --global user.name
$ git config --global user.email
# 取消设置的全局账户
$ git config --global --unset user.name
$ git config --global --unset user.email
# 通过以下语句设置的不同文件夹下的账户信息
$ git config user.name "your name"
$ git config user.email "your email"
$ ssh-keygen -t rsa -f ~/.ssh/id_rsa_pjhubs -C "[email protected]"
$ cd ~/.ssh
# cat 出来的内容全部复制
$ cat id_rsa_pjhubs.pub
# 使用-K可以将私钥添加到钥匙串,不用每次开机后还要再次输入这条命令
$ ssh-add -K ~/.ssh/id_rsa_pjhubs
# 查看已添加的内容
$ ssh-add -l
$ cd ~/.ssh/
# 没有config文件时,用以下命令生成
$ touch config
config 文件中键入以下内容:
Host github.com
HostName github.com
User git
IdentityFile ~/.ssh/id_rsa_pjhubs
Host git.xxx.com
HostName git.xxx.com
User git
IdentityFile ~/.ssh/id_rsa
# 如果还有继续添加
$ ssh -vT [email protected]
$ ssh -vT [email protected]
# 出现 Hi,your name 等信息就稳妥了