账号一:githubgit
账号二:gitlabgithub
一、安装Git软件 二、在桌面打开Git,进行设置 git config --global user.name "userName"//github的账号名(也能够自定义) git config --global user.email "emailAdress"//github的邮箱地址(也能够自定义) 三、生成ssh密钥 ssh-keygen -t rsa -C "githubEmailAdress"//github邮箱地址
一路的回车键shell
在github上将id_rsa.pub
文件内容添加上(怎么添加请百度)bash
ssh-keygen -t rsa -C "gitlabEmailAdress" # 设置名称为id_rsa_gitlab Enter file in which to save the key (/c/Users/Administrator/.ssh/id_rsa): id_rsa_gitlab
在.ssh 路径下面会生成一个id_rsa_gitlab文件服务器
ssh-agent bash ssh-add ~/.ssh/id_rsa_work
# 该文件用于配置私钥对应的服务器 # Default github user Host github HostName github.com User git IdentityFile C:/Users/Administrator/.ssh/id_rsa # second user Host gitlab HostName your gitlab host address User git IdentityFile C:/Users/Administrator/.ssh/id_rsa_gitlab
将id_rsa_gitlab.pub
中的内容添加到gitlab账号下的SSH Key中ssh
$ ssh -T github Hi jj! You've successfully authenticated, but GitHub does not provide shel l access. $ ssh -T gitlab Hi jj! You've successfully authenticated, but GitHub does not provide shell access.
这里的github与gitlab就是config文件中的Host值ide
正常状况咱们要clone一个github工程是这样的gitlab
git@github.com:jj/JForm.git
现在在github工程是这样的测试
git clone github:jj/JForm.git
缘由就是config网站
还有一个问题就是提交的邮箱地址和用户名是根据下面配置
git config --global user.name "userName"//github的账号名(也能够自定义) git config --global user.email "emailAdress"//github的邮箱地址(也能够自定义)