当前位置:   article > 正文

同时使用github和gitlab_guthub和gitlab通用吗

guthub和gitlab通用吗

同时使用github和gitlab


一、生成GitHub\GitLab钥匙

  • GitHub钥匙
ssh-keygen -o -t rsa -C "email@example.com"
  • 1

设置文件保存名称

Enter file in which to save the key (C:\Users\Administrator/.ssh/id_rsa): id_rsa_github
  • 1

GitLab同理


生成文件如下图:
在这里插入图片描述

二、创建并修改config文件

# gitlab

# host 换成IP

Host gitlab.com

PreferredAuthentications publickey

IdentityFile ~/.ssh/id_rsa_gitlab



# github

Host github.com

PreferredAuthentications publickey

IdentityFile ~/.ssh/id_rsa_github

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20

三、验证是否能登录

ssh -vT git@github.com
  • 1
C:\Users\Administrator>ssh -vT git@github.com
OpenSSH_for_Windows_7.7p1, LibreSSL 2.6.5
debug1: Reading configuration data C:\\Users\\Administrator/.ssh/config
debug1: C:\\Users\\Administrator/.ssh/config line 7: Applying options for github.com
debug1: Connecting to github.com [192.30.255.113] port 22.
debug1: Connection established.
****************************************************************************************
****************************************************************************************
****************************************************************************************
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
**Hi fanlizhichzu! You've successfully authenticated, but GitHub does not provide shell access.
debug1: channel 0: free: client-session, nchannels 1**
  • 1
  • 2
Transferred: sent 2560, received 2612 bytes, in 0.6 seconds
  • 1
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/喵喵爱编程/article/detail/819377
推荐阅读
相关标签
  

闽ICP备14008679号