首页 > 其他分享 >git设置ssh key 同时配置Gitee和GitHub

git设置ssh key 同时配置Gitee和GitHub

时间:2023-09-23 18:12:18浏览次数:34  
标签:github -- global Gitee GitHub ssh git gitee

背景:

由于一直用gitee来git代码,并且一直通过ssh无密码连接本地和gitee远程仓库。

最近想使用github的GitHub Pages的部署功能,就不得不在github上建立远程仓库,并使用ssh方式来git代码。

这个时候就发现,之前的ssh秘钥不能同时在gitee和github上使用。

问题解决:

  1. 之前的ssh秘钥还是用在gitee连接上
  2. 现在的github,再重新用一个新的邮箱来申请新的ssh秘钥

 

以下所有命令建议在git bash中完成

0.清除git的全局设置

如果是之前没设置过的,就不用清除了。可以通过git config --global --list来查看是否设置过。

git config --global --unset user.name "你的名字"
git config --global --unset user.email "你的邮箱"

1.生成新的SSH keys(针对github)

ssh-keygen -t rsa -f ~/.ssh/id_rsa.github -C "[email protected]"

疯狂回车即可。

完成后会在~/.ssh / 目录下生成以下文件。

标签:github,--,global,Gitee,GitHub,ssh,git,gitee
From: https://www.cnblogs.com/pwindy/p/17724846.html

相关文章

  • Android Failed to resolve: com.github.PhilJay:MPAndroidChart:v3.1.0
    2022.3.1版本修改settings.gradledependencyResolutionManagement{repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)repositories{maven{url"https://jitpack.io"}//Addthisrepositoryjcenter()//orotherrep......
  • git SSL certificate problem unable to get local issuer certificate
    gitSSLcertificateproblemunabletogetlocalissuercertificate这个问题是由于没有配置信任的服务器HTTPS验证。默认,cURL被设为不信任任何CAs,就是说,它不信任任何服务器验证。只需要执行下面命令就可以解决:gitconfig--globalhttp.sslVerifyfalse......
  • Git 基础使用
    简易的命令行入门教程:Git全局设置:gitconfig--globaluser.name"liuzonglin"#设置用户签名gitconfig--globaluser.email"[email protected]"#设置用户邮箱创建git仓库:mkdir<仓库名>cd<仓库名>gitinit#初始化本地库touchREADME.mdgitaddREADME.m......
  • Git版本控制
    Git版本控制注意:开始学习之前,确保自己的网络可以畅通的连接Github:https://github.com,这个是一个国外网站,连起来特别卡,至于用什么方式实现流畅访问,懂的都懂。其实版本控制在我们的生活中无处不在,比如你的期末或是毕业答辩论文,由于你写得不规范或是老师不满意,你的老师可能会让你......
  • git 删除本地、远程分支
     删除远程分支:gitpushorigin:branchName #删除远程分支 gitpushorigin--deletestark#删除远程分支stark  常用删除本地分支:gitbranch-dbranchName  #删除本地分支,强制删除用-D gitbranch-dstark   #删除本地stark分支  gitbranch-......
  • git rebase分支的流程和注意事项
    比如有两个开发了比较多功能的分支,或者在比较久的一次提交上做了一个hotfix,这个时候如果合并,通过ui查看会有一条额外的很长的线连接过来,不美观,看起来也不方便。可以用rebase进行变基,强行把两个分支的内容合并到一起。rebase与merge的区别merge就是把两个分支,当前的内容,进行比较......
  • 创建mdbook和gitbook文档
    mdbook:https://github.com/AgoCan/code-generator/blob/main/docs/mdbook.mdgitbook:https://github.com/AgoCan/code-generator/blob/main/docs/gitbook.md直接执行脚本,然后就可以直接使用了......
  • 从GitHub更新代码后新的项目类的图标会变成大写的J解决办法【杭州多测师_王sir】
     项目地址:https://github.com/macrozheng/mall-learning/tree/teach一、切换分支更新GitHub的代码发现拉取下来变文件夹了,类的图标会变成大写的J二、解决办法:找到项目的pom.xml右键,在靠近最下方的位置找到Add as Maven Project点击即可。此时,一般类的图标就变成C了,但是可......
  • Git指令
    记录常用的Git指令。配置username和emailgitconfiguser.name"[email protected]"gitconfiguser.email"[email protected]"替换user-name和emailitconfig--replace-alluser.name"adma"itconfig--replace-alluser.email"[email protected]&quo......
  • Learn Git in 30 days—— 第 23 天:修正 commit 过的版本历史记录 Part 5
    写的非常好的一个Git系列文章,强烈推荐原文链接:https://github.com/doggy8088/Learn-Git-in-30-days/tree/master/zh-cn 我们上一篇文章谈到的Rebase是用来将现有的两个分支进行「重新指定基础版本」,执行Rebase之后,也会改掉原本分支的起点(分支点移动了),所以导致版本线......