背景
可能是中国内地网络环境的原因,Git通过ssh推送到自己的存储库发生以下错误。大概是github.com的22端口被屏蔽了?
root@yst-ubuntu:~/dev-chaos-test-system/chaos-test-system# git push origin dev
ssh: connect to host github.com port 22: Connection refused
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
通过HTTPS也不行,以下错误提示大意是 2021-08-13 密码认证被移除了。官方中文文档 文档里似乎没说密码认证被移除这回事
root@yst-ubuntu:~/dev-chaos-test-system/chaos-test-system# git push hub_https dev
Username for 'https://github.com': YuSitong1999
Password for 'https://YuSitong1999@github.com':
remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/YuSitong1999/chaos-test-system.git/'
解决
官方文档: 在 HTTPS 端口使用 SSH文章来源:https://www.toymoban.com/news/detail-816532.html
链接格式和GitHub提供的前两条HTTPS和SSH链接不一样。文章来源地址https://www.toymoban.com/news/detail-816532.html
https://github.com/YuSitong1999/chaos-test-system.git
git@github.com:YuSitong1999/chaos-test-system.git
ssh://git@ssh.github.com:443/YuSitong1999/chaos-test-system.git
到了这里,关于Git推送到Guthub错误:ssh: connect to host github.com port 22: Connection refused的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!