SSH的Github多账户配置

栏目: 服务器 · 发布时间: 6年前

内容简介:又新开了一个github账户,以防不测。习惯了使用ssh key访问Github,在给新账户添加ssh公钥的时候,Github禁止添加重复的密钥,换句话说,两个账户不可以共享同一个密钥。给不同的用户设置不同的密钥本来很简单:但是这个对于Github的多账户不行,因为所有账户用的都是同一个ssh账户

又新开了一个github账户,以防不测。

习惯了使用ssh key访问Github,在给新账户添加ssh公钥的时候,Github禁止添加重复的密钥,换句话说,两个账户不可以共享同一个密钥。给不同的用户设置不同的密钥本来很简单:

Host github.com
        HostName github.com
        User git
        IdentityFile ~/.ssh/id_rsa

但是这个对于Github的多账户不行,因为所有账户用的都是同一个ssh账户 git 。解决办法仍然是通过修改 ~/.ssh/config :

Host github.com-user1
        HostName github.com
        User git
        IdentityFile ~/.ssh/id_rsa_user1

Host github.com-user2
        HostName github.com
        User git
        IdentityFile ~/.ssh/id_rsa_user2

通过 -userX 这个Host后缀可以区分。


以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

Beginning ASP.NET 4 in C# and Vb

Beginning ASP.NET 4 in C# and Vb

Imar Spaanjaars / Wrox / 2010-3-19 / GBP 29.99

This book is for anyone who wants to learn how to build rich and interactive web sites that run on the Microsoft platform. With the knowledge you gain from this book, you create a great foundation to ......一起来看看 《Beginning ASP.NET 4 in C# and Vb》 这本书的介绍吧!

在线进制转换器
在线进制转换器

各进制数互转换器

Base64 编码/解码
Base64 编码/解码

Base64 编码/解码

URL 编码/解码
URL 编码/解码

URL 编码/解码