美文网首页
配置SSH Key连接GitLab

配置SSH Key连接GitLab

作者: Hengry | 来源:发表于2019-04-11 09:45 被阅读0次

Git配置ssh连接相关命令:

1、配置账号

$ git config —global user.name "cwh"

$git config —global user.email "cwh@xxx.com"

邮箱需要GitLab上账号配置相对应的邮箱,否则拉取、或者更新不了项目代码

2、生成 SSH 密钥

$ ssh-keygen -t rsa -C “cwh@xxx.com

2.1 查看ssh公钥

$cat id_rsa.pub

2.2 ssh存放路径

~/.ssh

2.3在GitLab账号中心设置SSH Keys

3、克隆项目

$git clone git@xxx.git

或者项目涉及包含子项目则执行下面的命令

$git clone git@xxx.git --recursive

3.1测试ssh连接

$ssh -T git@xxx.git

3.2将克隆的项目直接拖到SoureTree进行打开

【参考】

  1. 使用SSH连接到GitHub
  2. GitLab配置ssh key
  3. sourceTree 添加 ssh key 方法
  4. sourceTree 添加 ssh key 方法

相关文章

网友评论

      本文标题:配置SSH Key连接GitLab

      本文链接:https://www.haomeiwen.com/subject/vnuziqtx.html