怎么低成本做网站,画册设计网站,价格低怎么说好听,wordpress d8 修改零、前言
因为要在ubuntu上做点东西#xff0c;发现git clone 的时候必须输账户密码#xff0c;后来发现密码是token#xff0c;但是token一大串太烦了#xff0c;忙了一天发现可以通过配置 公钥 来 替代 http 的 部署方式。 一、生成 ssh 密钥对
我们先测试下能不能 连接…零、前言
因为要在ubuntu上做点东西发现git clone 的时候必须输账户密码后来发现密码是token但是token一大串太烦了忙了一天发现可以通过配置 公钥 来 替代 http 的 部署方式。 一、生成 ssh 密钥对
我们先测试下能不能 连接上发现直接 deny 了
rootLAPTOP-292TJJC6:~/.ssh# ssh -T gitgithub.com
The authenticity of host [ssh.github.com]:443 ([20.205.243.160]:443) cant be established.
ECDSA key fingerprint is SHA256:p2QAMXNIC1TJYWeIOttrVc98/R1BUFWu3/LiyKgUfQM.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added [ssh.github.com]:443,[20.205.243.160]:443 (ECDSA) to the list of known hosts.
gitssh.github.com: Permission denied (publickey).然后在 终端中输入 ssh-keygen
第一个让设置放在哪我们直接回车不用管
然后会让你输入一个密码确认密码
rootLAPTOP-292TJJC6:~# ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_rsa
Your public key has been saved in /root/.ssh/id_rsa.pub此时就会给我们生成一个密钥我这里是在 /root/.ssh/id_rsa
我们进入发现有还有另一个文件 id_rsa.pub
rootLAPTOP-292TJJC6:~# cd /root/.ssh/
rootLAPTOP-292TJJC6:~/.ssh# ll
total 24
drwx------ 2 root root 4096 Oct 3 21:13 ./
drwx------ 9 root root 4096 Oct 3 21:11 ../
-rw-r--r-- 1 root root 58 Oct 3 21:11 config
-rw------- 1 root root 2655 Oct 3 21:14 id_rsa
-rw-r--r-- 1 root root 574 Oct 3 21:14 id_rsa.pub
-rw-r--r-- 1 root root 888 Oct 3 21:11 known_hostspub 即 public就是公钥不带pub的那个就是私钥
我们打开复制然后进入下一个part
二、配置 GitHub 公钥
进入 settings 进入 SSH and GPG keys 点击创建一个新的 SSH key 然后把我们的公钥粘贴到下面点确认就好了
三、测试链接
我们回到Ubuntu来测试一下行不行。
rootLAPTOP-292TJJC6:~/.ssh# ssh -T gitgithub.com
Enter passphrase for key /root/.ssh/id_rsa:
Hi 58164! Youve successfully authenticated, but GitHub does not provide shell access.这个时候 git clone 也能通过 ssh 来部署了 哈铪搞一天快哭了
tHub does not provide shell access. 这个时候 git clone 也能通过 ssh 来部署了 哈铪搞一天快哭了