mac生成SSH证书且修改host

2020-05-11  本文已影响0人  coder_xiang

生成SSH

An SSH key allows you to establish a secure connection between your computer and GitLab. Before generating an SSH key in your shell, check if your system already has one by running the following command:

cat ~/.ssh/id_rsa.pub

To generate a new SSH key, use the following command:

ssh-keygen -t rsa -C "weixiang.liu@ubtrobot.com"

This command will prompt you for a location and filename to store the key pair and for a password. When prompted for the location and filename, just press enter to use the default. If you use a different name, the key will not be used automatically.

Use the command below to show your public key:

cat ~/.ssh/id_rsa.pub

Copy-paste the key to the 'My SSH Keys' section under the 'SSH' tab in your user profile. Please copy the complete key starting with ssh-rsa and ending with your username and host.

To copy your public key to the clipboard, use the code below. Depending on your OS you'll need to use a different command:

pbcopy < ~/.ssh/id_rsa.pub

修改Host

1、打开命令终端,输入下面的命令,进入hosts文件:

sudo vim /etc/hosts

2、查看host

more /etc/hosts

查看本地ssh 的方法
终端输入:

cd ~/.ssh
open .

就能看到你的私人秘钥了

git config --global http.sslVerify false

参考文章 https://confluence.atlassian.com/bamkb/ssl-certificate-subject-305037865.html

上一篇 下一篇

猜你喜欢

热点阅读