git 同时配置 gitee github教程 超简单

git 同时配置 gitee github教程

1.安装git 自行百度

(若不是第一次配置git 请清除全局配置)

查看git全局配置
git config --global -l

删除全局配置
git config --global --edit

其他参考命令:
添加git全局范围的用户名和邮箱:
git config --global user.email [email protected]
git config --global user.name abc

2.进入SSH路径

2.1 在桌面上右键 Git Bash Here 进入git命令行模式
依次输入一下命令:
cd
cd ./.ssh

就会进入.ssh文件夹 或者直接在C:\Users\用户名\.ssh 下直接 git bash here

git 同时配置 gitee github教程 超简单_第1张图片

3.创建ssh keys(一直回车不用输入ras文件名和密码)

gitee 创建 ssh keys:
ssh-keygen -t rsa -f ~/.ssh/id_rsa.gitee -C "自己的邮箱@qq.com"

github 创建 ssh keys:
ssh-keygen -t rsa -f ~/.ssh/id_rsa.github -C "自己的邮箱@qq.com"

git 同时配置 gitee github教程 超简单_第2张图片

4.识别ssh keys 新的秘钥

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

5.创建config 文件

创建config
touch ~/.ssh/config 

config 中填写内容
#Default gitHub user Self
Host github.com
    HostName github.com
    User git
    IdentityFile ~/.ssh/id_rsa.github

# gitee
Host gitee.com
    Port 22
    HostName gitee.com
    User git
    IdentityFile ~/.ssh/id_rsa.gitee

6.添加ssh 到gitee 和 github账号(文件在.ssh 文件夹中)

id_rsa.github.pub 中的内容填进去,随便起名字 github: https://github.com/settings/keys

id_rsa.gitee.pub 中的内容填进去,随便起名字 gitee: https://gitee.com/profile/sshkeys

7.测试

ssh -T [email protected]
ssh -T [email protected]

m/profile/sshkeys

7.测试

ssh -T [email protected]
ssh -T [email protected]

git 同时配置 gitee github教程 超简单_第3张图片

你可能感兴趣的:(git,github,ssh)