使用ssh远程访问github
2023-09-27 14:21:14 时间
使用环境
window7系统
环境
git软件(携带的bash终端类似linux的终端很好用建议安装)
有一个可用的github账号
1. 先生成需要的PUBLIC KEY
打开bash
软件执行如下命令
ssh-keygen -t rsa
指定生成key的路径名称,一路回车即可
$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/c/Users/lenovo/.ssh/id_rsa): /c/Users/lenovo/.ssh/id_rsa_github_hexo
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /c/Users/lenovo/.ssh/id_rsa.
Your public key has been saved in /c/Users/lenovo/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:ULsfGWCKY1aJqFQ24QkUxuPu3TiBqoJHXy6mHpQ/i0k lenovo@lenovo-PC
The key's randomart image is:
+---[RSA 2048]----+
|o=o*....+ |
|.+= +o.+ o |
|o..o= o . . |
|.. + . . . o |
|. + S o |
| +.o . . . |
|+.E.*o . |
|+o.B++. |
|+o=oo. |
+----[SHA256]-----+
这样我们就在~/.ssh
路径下生成两个文件id_rsa
和id_rsa.pub
$ ll ~/.ssh
total 15
-rw-r--r-- 1 lenovo 197121 114 九月 19 14:32 config
-rw-r--r-- 1 lenovo 197121 1679 九月 17 14:58 id_rsa
-rw-r--r-- 1 lenovo 197121 398 九月 17 14:58 id_rsa.pub
2. 打开github的 ssh 管理页面把 对应的公钥提交保存到代码管理服务器 (.pub 结尾)
在终端执行
cat id_rsa.pub
github
具体位置在 点击账户的Settings
中的SSH and FPG keys
点击New SSH key
绿色按钮 输入自己本地id_rsa_github_hexo.pub
中的内容
3. 测试配置完毕后是否可以ssh访问github
$ ssh -T git@github.com
Hi qnyt1993! You've successfully authenticated, but GitHub does not provide shell access.
这里表明已经可以了,配置结束
相关文章
- SSH 工具 MobaXterm 的安装和使用
- 菜鸟学习SSH——目录
- github与git 实现多人开发的配置,使用htps和ssh两种方式
- 将Git与Github进行SSH连接
- ESXi去掉 SSH已经启用的警告信息
- 如何的退出无响应的 SSH 连接
- 生成SSH秘钥连接github(详细教程)
- Linux SSH Publickey登录
- github连接报"ssh: connect to host github.com port 22: Connection timed out"错误
- GitHub(Gitee同理)配置SSH
- 【甄选靶场】Vulnhub百个项目渗透——项目十一:skytower-1(代理登录ssh,绕过shell禁用)
- ssh-keygen的使用方法及配置authorized_keys两台linux机器相互认证
- GitHub/Gitlab SSH配置
- windows下GitHub的SSH Key 配置
- ansible报错:Failed to connect to the host via ssh: Permission denied
- Centos 7 SSH 无密码登录
- 关于github的ssh, permission denied(publickey)