SourceTree 配置 GitLab
Posted android-dangdang
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了SourceTree 配置 GitLab相关的知识,希望对你有一定的参考价值。
生成SSH
- 创建SSH,执行
ssh-keygen -t rsa -C "youremail@example.com"
,会在.ssh目录下生成id_rsa
、id_rsa.pub
两个私钥和公钥。

image.png
- 有个路径需要填写 直接复制箭头部分就可以
- 通过
cat ~/.ssh/id_rsa.pub
查看公钥,并将公钥整体复制,配置到GitHub等后台。
image.png
从头到尾都复制,放到key中 然后自动会生成 RW 钥匙那个样子

image.png
配置本地SSH
- 执行
ssh-add ~/.ssh/id_rsa
将sshkey添加到sourceTree(会输入密码) - 执行
ssh-add -K ~/.ssh/id_rsa
将sshkey添加到钥匙串 - cd 到 .ssh目录下, 用touch config命令创建config文件
- 执行open config, 打开config文件,输入以下内容并保存
Host *
UseKeychain yes
AddKeysToAgent yes
IdentityFile ~/.ssh/id_rsa
打开Source Tree 克隆

以上是关于SourceTree 配置 GitLab的主要内容,如果未能解决你的问题,请参考以下文章