gitlab,gerrit 容器化私库 多 ssh密钥配置

本文介绍了如何在多库环境下管理SSH密钥,特别是针对GitLab和Gerrit的容器化私有仓库。通过生成自定义名称的SSH密钥,配置~/.ssh/config文件,并为每个服务指定不同的IdentityFile和Host,实现不同服务的区分登录。成功配置后,可以使用ssh -T进行连接测试。

多库下ssh密钥管理.

 

生成 ssh 密钥时,填入自定义密钥名字 例id_rsa.gerrit

ssh-keygen -t rsa -C "*******@qq.com"
Generating public/private rsa key pair.
Enter file in which to save the key (/c/Users/Work/.ssh/id_rsa): id_rsa.gerrit

一路enter

1.将id_rsa.gerrit.pub 公钥复制到客户端,cat  ~/.ssh/id_rsa.gerrit.pub

2.在 ~/.ssh/ 路径下建立文件 config文件  touch ~/.ssh/config

3.vi  ~/.ssh/config 

输入

####内网的gerrit 地址

Host 172.16.16.222

### 没有hostname 就填ip
     HostName 172.16.16.222

### 私钥的路径
     IdentityFile ~/.ssh/id_rsa.*****gitlab

#### git config (--golabel) user.name 的值
     User liulingdi

### ssh端口,镜像搭建的gitlab,端口30187是由 gitlab 的ssh端口 22 映射出
     Port 30187

####多服务配置添加如上,公网的github,则填域名即可,port端口默认不用填写
Host github.com
     HostName git

cd /ge400v1/Iplatform/build && /ge400v1/Iplatform/build/../utils/gitPrivateClone/gitlab-private-clone wifi-driver/wifix ssh://gerrit.cp.tp-link.com:29418/wifi-driver/wifix.git bcm_dev "" ../packages/private/wifix Found "../packages/private/wifix", do nothing! Check & init submodules cd /ge400v1/Iplatform/build/.. && git submodule init && git submodule update --remote Submodule 'packages/private/wifix' (ssh://wangzhiheng@gerrit.cp.tp-link.com:29418/wifi-driver/wifix) registered for path 'packages/private/wifix' Submodule 'packages/submodules/easymesh' (ssh://wangzhiheng@gerrit.cp.tp-link.com:29418/Router/Iplatform/easymesh) registered for path 'packages/submodules/easymesh' Submodule 'packages/submodules/mesh_aps' (ssh://wangzhiheng@gerrit.cp.tp-link.com:29418/Router/Iplatform/mesh_aps) registered for path 'packages/submodules/mesh_aps' Submodule 'packages/submodules/telemetry' (ssh://wangzhiheng@gerrit.cp.tp-link.com:29418/Router/Iplatform/telemetry) registered for path 'packages/submodules/telemetry' The authenticity of host '[gerrit.cp.tp-link.com]:29418 ([10.176.69.35]:29418)' can't be established. ECDSA key fingerprint is SHA256:7dS5ZuQZrDUBNxaqcVTwhLo7TLAM6pEglkec3JCwCks. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added '[gerrit.cp.tp-link.com]:29418,[10.176.69.35]:29418' (ECDSA) to the list of known hosts. wangzhiheng@gerrit.cp.tp-link.com: Permission denied (publickey). fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists. Unable to fetch in submodule path 'packages/private/wifix' /ge400v1/Iplatform/build/product_configs/ge400v1/product.mk:433: recipe for target 'check_submodule' failed make: *** [check_submodule] Error 1 huaxi@28ca71c23072:/ge400v1/Iplatform/build$
最新发布
11-15
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值