终极办法!connect to host port 22: Connection timed out git@ssh.github.com: Permission denied (publickey

这篇具有很好参考价值的文章主要介绍了终极办法!connect to host port 22: Connection timed out git@ssh.github.com: Permission denied (publickey。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

过了个周末git突然用不了了,在拉代码的时候突然报错连接超时,又报错说没有权限,这就很烦了
在百度了很久以后尝试了各种办法,重新生成pub_key,重装git等等都没能解决,最后询问了公司大佬,困扰了一个上午的问题终于解决了
先说说百度上的解决办法:

1.替换秘钥

使用命令 ssh-keygen -t rsa 直接生成默认的rsa文件,之后在github上配置pub即可

2.配置config

生成rsa文件时自定义文件名,需要在 .ssh 目录下添加一个config文件,样例如下:

# gitee
Host gitee.com
HostName gitee.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/gitee_id_rsa
# github
Host github.com
HostName github.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/github_id_rsa

其中 Host 和 HostName 后填写 git 服务器的域名,IdentityFile 指定私钥的路径(只需要修改 IdentityFile )

然后用命令测试一下成功没

ssh -T git@github.com

3.配置代理

1.打开文件夹C:\Users\Administrator.ssh(Administrator是当前用户名),在空白处点鼠标右键选择“Git Bush Here”

2.输入命令:ssh-keygen -t rsa -C “xx@example.com”, youremail@example.com改为自己的邮箱即可,途中会让你输入密码啥的,不需要管,一路回车即可,会生成你的ssh key。

3.然后再执行命令:ssh -v git@github.com
这个时候可能会报错:

    No more authentication methods to try.  

    Permission denied (publickey).

4.不管报错继续输入:ssh-agent -s 这时候又会报错,如果这次报错了就输入:

eval ssh-agent -s

然后继续执行命令

ssh-add ~/.ssh/id_rsa

这时候一般就不会报错了

5.打开你刚刚生成的id_rsa.pub,将里面的内容复制,进入你的github账号,在settings下,SSH and GPG keys下new SSH key,title随便取一个名字,然后将id_rsa.pub里的内容复制到Key中,完成后Add SSH Key。

6.输入命令:ssh -T git@github.com 验证一下看成功没

我的解决办法

以上的方法很不幸,我都试了,都没用,我的解决办法给大家分享一下:

1.在项目目录下右键点击git Bash Here,打开git

2.在电脑左下角搜索打开Windows凭据

github ssh连接超时,学习路上的问题,git,github,ssh
3.在普通凭据里找到GitHub的删除
github ssh连接超时,学习路上的问题,git,github,ssh
4.在打开的git bash里输入如下命令

git clone http://userName:password@**.**.*.***:8082/root/Assessment_backend.git/

其中username是你登录git的用户名,不是邮箱!!!
password就是你登录git的密码

@后面是自己的仓库地址和端口号

然后就可以把代码拉下来了。
最后在Windows凭据里加上一个github的普通凭据就可以了!文章来源地址https://www.toymoban.com/news/detail-756363.html

到了这里,关于终极办法!connect to host port 22: Connection timed out git@ssh.github.com: Permission denied (publickey的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

  • 解决git报错:ssh:connect to host github.com port 22: Connection timed out

    如题,git使用中突然报错 ssh:connect to host github.com port 22: Connection timed out 通过查阅各种资料,得知原因可能是由于电脑的防火墙或者其他网络原因导致ssh连接方式 端口22被封锁。 一:抛弃ssh连接方式,使用http连接。 进入.ssh文件夹   创建一个config文件 将下面的内容复制进去

    2024年02月16日
    浏览(20)
  • git报错处理:ssh:connect to host github.com port 22: Connection timed out

    git 在上传、下载 文件的时候,报错。 报错信息: ssh:connect to host github.com port 22: Connection timed out 提示这个域名github.com port 的22 端口,链接超时。 我直接访问github.com 这个域名是可以访问的,ping 也是可以ping通的。 使用telnet 链接github.com 的22 端口,报超时错误。 所以,问题

    2024年02月11日
    浏览(19)
  • github 推送报错 ssh: connect to host github.com port 22: Connection timed out 解决

    🚀 作者主页: 有来技术 🔥 开源项目: youlai-mall 🍃 vue3-element-admin 🍃 youlai-boot 🌺 仓库主页: Gitee 💫 Github 💫 GitCode 💖 欢迎点赞 👍 收藏 ⭐留言 📝 如有错误敬请纠正! git push 推送 github 报错如下: 找到 .ssh 文件夹新增 config 配置文件 添加以下配置即可 使用 ssh -T g

    2024年01月25日
    浏览(26)
  • Git提交 ssh: connect to host github.com port 22: Connection timed out解决方案

    你们好,我是金金金。 之前都是好好的,不知道今天为什么提交代码就这样了 根据英文可以看出,ssh端口号被拒绝了,22号端口不行,那就换一个端口 ssh端口被拒绝 找到.ssh文件,在下面创建一个config文件,然后记事本打开写入以下内容 成功提交 主要是ssh 22端口被拒绝,我

    2024年01月22日
    浏览(29)
  • 解决 Git:ssh: connect to host github.com port 22: Connection timed out 问题的三种方案

    其一、整体提示为: ssh: connect to host github.com port 22: Connection timed out fatal: Could not read from remote repository. 中文为: ssh:连接到主机 github.com 端口 22:连接超时 fatal:无法从远程存储库读取 其二、问题描述为: A、正常的将代码提交到 git 仓库的过程: step1、找到要提交 git 的代

    2024年01月25日
    浏览(29)
  • 【git】解决git报错:ssh:connect to host github.com port 22: Connection timed out 亲测有效

    如题,git使用中突然报错 ssh:connect to host github.com port 22: Connection timed out 通过查阅各种资料,得知原因可能是由于电脑的防火墙或者其他网络原因导致ssh连接方式 端口22被封锁。 创建一个config文件 将下面的内容复制进去 保存退出 检查是否成功 这里要根据它的提示操作,有个

    2024年02月05日
    浏览(26)
  • 解决ssh:connect to host github.com port 22: Connection timed out与kex_exchange_identification

    无法进行clone项目和其他Git操作。执行检测连接命令 ssh -T git@github,com 报错 ssh:connect to host github.com port 22: Connection timed out 即:连接22端口超时 涉及到的文件 : C:UsersJIACHENGER.sshconfig C:UsersJIACHENGER.sshgithub_id_rsa C:UsersJIACHENGER.sshgithub_id_rsa.pub C:UsersJIACHENGER.sshknown_hosts 生成

    2024年02月06日
    浏览(25)
  • ssh: connect to host github.com port 22: Connection timed out fatal: Could not read from remote……

    登录了一下github网站,发现可以访问: 但是,ping了一下github,发现请求超时。 git、命令行都无法正确解析域名,但浏览器可以,有些奇怪。 但可以判断,确实是网络域名解析出现了问题,下面将采用手动修改hosts文件的方式解决。 打开网站:https://www.ipaddress.com/ip-lookup,并

    2024年01月18日
    浏览(24)
  • $ git push ssh: connect to host github.com port 22: Connection timed out fatal: Could not read from

    之前都好好的,今天 git push 突然出现这个问题 解决方法一:改用HTTP协议(我没试过,应该是可以的) 就是把远程库地址改成HTTP协议的,好像是这个命令,自己搜一下 git remote set-url origin https://username@github.com/username/repository.git 解决方法二:更改SSH端口 (亲测可用) 先试试

    2024年01月20日
    浏览(24)
  • ssh: connect to host github.com port 22: Connection timed out fatal: Could not read from remote repo

    问题描述: 在使用Git将本地仓库推送到远程仓库的时候,发生了如下错误:“fatal: Could not read from remote repository.” 1、首先输入以下命令检查SSH是否能够连接成功(ssh后面有空格) 发现报错:端口连接超时。 解决方案(亲测有效) 在C盘——用户——你的主机名文件夹中找到

    2024年01月20日
    浏览(26)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包