git 密钥 多密钥 key 解决方案

资料来自stackoverflow.......我这里是拿来党最喜欢的demo

来,跟我左右右手一个慢动作

cd ~/.ssh && ssh-keygen

Enter file in which to save the key (/Users/baidu/.ssh/id_rsa):  这里输入对应的名称,比如 github_rsa, hzz_rsa, baidu_rsa    (你要是都存id_rsa,那就只有一个key了,别问我为什么,按我说的做,吻我)


cat hzz_rsa.puh


好,复制到网站上对应的地方去。。。然后修改名称为你喜欢的名称



好了,ok了。


伟大的stackoverflow是万能的!

First start by setting up your own public/private key pair set. This can use either DSA or RSA, so basically any key you setup will work. On most systems you can use ssh-keygen.

  • First you'll want to cd into your .ssh directory. Open up the terminal and run:
    cd ~/.ssh && ssh-keygen

  • Generating public/private rsa key pair.
    Enter file in which to save the key (/Users/baidu/.ssh/id_rsa): 
      • enter the name you like (ps: zz add)
  • Next you need to copy this to your clipboard.
    • On OS X run: cat id_rsa.pub | pbcopy
    • On Linux run: cat id_rsa.pub | xclip
    • On Windows (via Cygwin/Git Bash) run: cat id_rsa.pub | clip
  • Add your key to your account via the website.
      • add you will get a user.name, you can change it as you like
  • Finally setup your .gitconfig.
    • git config --global user.name "bob"
    • git config --global user.email bob@... (don't forget to restart your command line to make sure the config is reloaded)

Thats it you should be good to clone and checkout.


  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值