首页 > 其他分享 >git 配置多个账号(你的&公司)

git 配置多个账号(你的&公司)

时间:2022-12-05 22:36:13浏览次数:56  
标签:git 多个 账号 配置 add ssh ed25519 id

配置步骤如下:

 

第一步:生成ssh 密钥时,多对密钥,要取不同的名字,用来区分(例如我比较喜欢用平台命名,命名为github 和 gitlab)

第二步:远程git 配置 ssh 公钥,各自配置各自平台。

第三步:配置SSH Config 文件。这个下面详细讲。

第四步:将两个密钥加入钥匙串,然后分别测试是否配置成功

 

 

 

~/.ssh/id_rsa_

 

 

ssh-add ~/.ssh/id_ed25519_company

 

you can delete all cached keys before

$ ssh-add -D

 

 

finally, you can check your saved keys

$ ssh-add -l

 

 

git config user.name "jexchan"

 

$ git config user.email "[email protected]

 

 

 

1: 

ssh-keygen -t ed25519 -C “name@company

 

ssh-keygen -t ed25519 -C “[email protected]"

 

Host github.com-yourname

  AddKeysToAgent yes

  IdentityFile ~/.ssh/id_ed25519

  User git

 

 

远程名字  id_ed25519_company

 

 

 

 

2:

标签:git,多个,账号,配置,add,ssh,ed25519,id
From: https://www.cnblogs.com/rshsmell/p/16953747.html

相关文章

  • MyGit:GitHub仓库更新提醒
    GitHub仓库更新提醒工具,微信小程序:MyGit一、解决痛点(需求)1、由于网络问题,想要查询GitHub经常打不开。2、当仓库发布新版本的时候,第一时间知道。3、发现更多有意思的......
  • git stash 使用
    gitstash使用gitstash:暂存当前分支上的修改,但不会commit,相当于add进栈里面去了,通常在gitcheckout之前执行此操作,可以保存本地的修改gitstashpop:弹出当前......
  • DigitalKey CCC3.0 URSK
    URSK有什么用,如何用URSK用于安全测距时测距数据的加解密车辆使用安全测距SetupFlow去激活一个pre-derivedURSK。每个车钥匙最多有一个pre-derivedURSK。当另一个激活......
  • 【git】——初始向github中提交项目
    【背景】  之前看过一小部分git相关的内容,一直想搞一搞git,之前的项目一直在用svn,前段时间想将自己写的项目提交到github中进行管理,又在做springcloud的小例子中涉及......
  • git commit提交代码时跳过 eslint校验
    在使用命令gitcommit-m'提交信息'将本地代码提交到远程仓库时候,如果项目安装了per-commit,则会在Git键入提交信息前进行代码风格检查,如果代码不符合相应规则,则报错。......
  • git 回滚commit记录
    1、本地commit了,但未push到远程,使用以下指令即可:$gitreset--hardHEAD^回退到上个版本$gitreset--hardHEAD~3回退到前3次提交之前,以此类推,回......
  • curl增加多个请求头的写法
    publicfunctionadd_brand(){$header=array('Content-Type:application/json','charset:utf-8','groupName:ns-v7g15','accountId:1626231450425742965');$token......
  • Windows更新Git
    1.打开Git命令行窗口;2.执行如下命令:gitupdate-git-for-windows3.如果报错,尝试在hosts(C:\Windows\System32\drivers\etc)中加入如下内容,我是在https://ip.tool.chin......
  • Gitee创建仓库后关联本地仓库
    全局设置gitconfig--globaluser.name"名字"gitconfig--globaluser.email"邮件"创建git仓库:mkdirworkbenchcdworkbenchgitinittouchREADME.mdgit......
  • gitlab安装使用,备份和升级
    安装依赖yuminstall-ycurlopenssh-serverpostfixwget 安装gitlab组件 yumlocalinstall-yxxx自动帮忙解决依赖 最新版本1)下载wgethttps://mirrors.tuna.tsing......