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

更新时间:2020-10-15    来源:php常用代码    手机版     字体:

【www.bbyears.com--php常用代码】

从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

本文来源:http://www.bbyears.com/jiaocheng/104812.html

热门标签

更多>>

本类排行