指引网

当前位置: 主页 > 操作系统 > Linux >

git建立信任:生成SSH key的方法

来源:网络 作者:佚名 点击: 时间:2017-05-13 00:33
[摘要]  下文我们一起来看一篇关于 git建立信任:生成SSH key的例子,希望这篇文章能够给各位朋友带来帮助,具体的如下文详解。

从Gitlab上使用ssh方式拉取git代码报错:The remote end hung up unexpected,经过排查,是公钥生成可能有问题,重新生成一下,然后在Gitlab上添加SSH key,再次拉取代码就好了。


SSH keys allow you to establish a secure connection between your computer and GitLa.(SSH Kyes用于本机和代码库主机建立信任。)

生成SSH Key

Open Git Bash.
Paste the text below, substituting in your GitHub email address.

Shell

ssh-keygen -t rsa -b 4096 -C "your_email@example.com"
# Creates a new ssh key, using the provided email as a label
Generating public/private rsa key pair.


Shell


Enter a file in which to save the key (/Users/you/.ssh/id_rsa): [Press enter]
At the prompt, type a secure passphrase. For more information, see “Working with SSH key passphrases”.

Shell

Enter passphrase (empty for no passphrase): [Type a passphrase]
Enter same passphrase again: [Type passphrase again]

生成好了,使用命令查看key,复制到Gitlab上。

cat ~/.ssh/id_rsa.pub

------分隔线----------------------------
栏目列表
推荐内容