0
点赞
收藏
分享

微信扫一扫

本地使用 GitHub 以及 Gitee

素锦时年_1b00 2022-02-20 阅读 51
githubgit

文章目录

1.1 清除原有 git 的全局配置

$ git config --global --list

image-20220220204533366

$ git config --global --unset user.name "chenlan"
$ git config --global --unset user.email "739904595@qq.com"

1.2 生成 ssh keys

$ ssh-keygen -t rsa -f ~/.ssh/id_rsa.github -C "739904595@qq.com"
$ ssh-keygen -t rsa -f ~/.ssh/id_rsa.gitee -C "739904595@qq.com"

image-20220220220856

1.3 将私钥添加到 ssh agent 中

$ ssh-agent bash
$ ssh-add ~/.ssh/id_rsa.github
$ ssh-add ~/.ssh/id_rsa.gitee

1.4 配置 config 文件

$ touch ~/.ssh/config

image-20220220220019828

# gitHub
Host github.com
HostName github.com
User chenlan
IdentityFile ~/.ssh/id_rsa.github

# gitee
Host gitee.com
HostName gitee.com
User chenlan
IdentityFile ~/.ssh/id_rsa.gitee

1.5 添加 ssh key

// 复制对应的公钥配置到 github 和 gitee 上
Setting -> SSH and GPG keys -> NEW SSH key

image-20220220231055226

举报

相关推荐

0 条评论