国产 无码 综合区,色欲AV无码国产永久播放,无码天堂亚洲国产AV,国产日韩欧美女同一区二区

解決 Git:ssh: connect to host github.com port 22: Connection timed out 問題的三種方案

這篇具有很好參考價值的文章主要介紹了解決 Git:ssh: connect to host github.com port 22: Connection timed out 問題的三種方案。希望對大家有所幫助。如果存在錯誤或未考慮完全的地方,請大家不吝賜教,您也可以點擊"舉報違法"按鈕提交疑問。

1、問題描述:

其一、整體提示為:

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 的代碼的地址:
xxxxxxxx@ubuntu:~/work/frs_stp/frs$

step2、查看當(dāng)前分支的命令:git branch
// 注意此時的分支就是:dev-xxxxxxxx

即:xxxxxxxx@ubuntu:~/work/frs_stp/frs$ git branch

解決 Git:ssh: connect to host github.com port 22: Connection timed out 問題的三種方案,# 前端所遇問題欄,git,ssh,github,經(jīng)驗分享,port 22,前端,虛擬機

step3、查看 git 的提交記錄(如:查看四行)的命令:git log --oneline -4

即:xxxxxxxx@ubuntu:~/work/frs_stp/frs$ git log --oneline -4

解決 Git:ssh: connect to host github.com port 22: Connection timed out 問題的三種方案,# 前端所遇問題欄,git,ssh,github,經(jīng)驗分享,port 22,前端,虛擬機

step4、準(zhǔn)備提交的狀態(tài)信息的命令:git status .

即:xxxxxxxx@ubuntu:~/work/frs_stp/frs$ git status .

解決 Git:ssh: connect to host github.com port 22: Connection timed out 問題的三種方案,# 前端所遇問題欄,git,ssh,github,經(jīng)驗分享,port 22,前端,虛擬機

step5、去掉不用提交的頁面操作的命令:git checkout
注意:上面的就是準(zhǔn)備提交的更改的東西(注意:要只提交 web 的內(nèi)容),下面的就是準(zhǔn)備提交的新的頁面;
即(注意有空格):xxxxxxxx@ubuntu:~/work/frs_stp/frs$ git checkout web/server/prog/handlers/* web/server/prog/url_handlers.in web/server/prog/web_common.h

解決 Git:ssh: connect to host github.com port 22: Connection timed out 問題的三種方案,# 前端所遇問題欄,git,ssh,github,經(jīng)驗分享,port 22,前端,虛擬機

step6、再次查看即將要提交信息的命令:git status .

即:xxxxxxxx@ubuntu:~/work/frs_stp/frs$ git status .

解決 Git:ssh: connect to host github.com port 22: Connection timed out 問題的三種方案,# 前端所遇問題欄,git,ssh,github,經(jīng)驗分享,port 22,前端,虛擬機

step7、 git 添加操作的命令:git add .

即:xxxxxxxx@ubuntu:~/work/frs_stp/frs$ git add .

解決 Git:ssh: connect to host github.com port 22: Connection timed out 問題的三種方案,# 前端所遇問題欄,git,ssh,github,經(jīng)驗分享,port 22,前端,虛擬機

step8、提交操作備注信息的操作:git commit -m "[]" .

即:xxxxxxxx@ubuntu:~/work/frs_stp/frs$ git commit -m "[型號][注釋][name][web]" .

解決 Git:ssh: connect to host github.com port 22: Connection timed out 問題的三種方案,# 前端所遇問題欄,git,ssh,github,經(jīng)驗分享,port 22,前端,虛擬機

step9、可能要存在的強推動作命令:
(即:此時就是基于 dev-xxxxxxxx 創(chuàng)建的新的分支 personal/xxx/qos):

即:xxxxxxxx@ubuntu:~/work/frs_stp/frs$ git push -u origin dev-xxxxxxxx:personal/xxx/qos --force

解決 Git:ssh: connect to host github.com port 22: Connection timed out 問題的三種方案,# 前端所遇問題欄,git,ssh,github,經(jīng)驗分享,port 22,前端,虛擬機

B、此時出現(xiàn)的問題是:強推動作命令拋錯:
之前這種操作并沒有問題,此時卻拋錯;
目的:想要將代碼推上去,完成代碼的合入;

其三、報錯面顯示為:

// 此時是提交的最后一步拋錯;

解決 Git:ssh: connect to host github.com port 22: Connection timed out 問題的三種方案,# 前端所遇問題欄,git,ssh,github,經(jīng)驗分享,port 22,前端,虛擬機

2、問題分析:

其一、可能是網(wǎng)絡(luò)的問題;
其二、可能是連接的 ssh 出了問題;
其三、默認推上去的端口 22 被占用;

3、問題解決:

其一、網(wǎng)絡(luò)問題的排除:
若頁面能訪問 git 庫,一般就說明網(wǎng)絡(luò)沒問題;
若瀏覽器訪問不了頁面等網(wǎng)絡(luò)問題,請看本篇文章:點擊跳轉(zhuǎn)

其二、可能是連接的 ssh 出了問題:
在對應(yīng)代碼下輸入命令:ssh -T git@github.com
即:jiyinhui@ubuntu:~/work/frs_stp/frs$ ssh -T git@github.com

A、若輸出結(jié)果如下:說明就是端口 22 被占用的問題;

解決 Git:ssh: connect to host github.com port 22: Connection timed out 問題的三種方案,# 前端所遇問題欄,git,ssh,github,經(jīng)驗分享,port 22,前端,虛擬機

B、若輸出結(jié)果如下:說明 ssh 的連接沒有問題(若不放心就重新 ssh 配置一下);

解決 Git:ssh: connect to host github.com port 22: Connection timed out 問題的三種方案,# 前端所遇問題欄,git,ssh,github,經(jīng)驗分享,port 22,前端,虛擬機

C、若是其它的結(jié)果,一般就說明就是 ssh 連接的問題;

其三、默認推上去的端口 22 被占用:

A、輸入命令,來查看配置信息 vim ~/.ssh/config

// 此時的信息就是拋錯:port 22: Connection timed out 的配置

解決 Git:ssh: connect to host github.com port 22: Connection timed out 問題的三種方案,# 前端所遇問題欄,git,ssh,github,經(jīng)驗分享,port 22,前端,虛擬機
B、修改配置信息為:

解決 Git:ssh: connect to host github.com port 22: Connection timed out 問題的三種方案,# 前端所遇問題欄,git,ssh,github,經(jīng)驗分享,port 22,前端,虛擬機

// 通過 vim ~/.ssh/config 查看的結(jié)果為:
// 注意:退出 vim 的命令為 :wq + 回車

解決 Git:ssh: connect to host github.com port 22: Connection timed out 問題的三種方案,# 前端所遇問題欄,git,ssh,github,經(jīng)驗分享,port 22,前端,虛擬機

代碼為:

Host github.com
	port 443
	HostName ssh.github.com
	IdentityFile ~/.ssh/xxxxxxxxxxxxxxxxxx

C、此時繼續(xù)推則能成功推上 git 去:

命令為:xxxxxxxx@ubuntu:~/work/frs_stp/frs$ git push -u origin dev-xxxxxxxx:personal/xxx/qos --force

解決 Git:ssh: connect to host github.com port 22: Connection timed out 問題的三種方案,# 前端所遇問題欄,git,ssh,github,經(jīng)驗分享,port 22,前端,虛擬機

// 然后再執(zhí)行 ssh -T git@github.com 命令的結(jié)果展示為:

解決 Git:ssh: connect to host github.com port 22: Connection timed out 問題的三種方案,# 前端所遇問題欄,git,ssh,github,經(jīng)驗分享,port 22,前端,虛擬機

D、可能存在的問題:

step1、拋 # 的錯誤:

解決 Git:ssh: connect to host github.com port 22: Connection timed out 問題的三種方案,# 前端所遇問題欄,git,ssh,github,經(jīng)驗分享,port 22,前端,虛擬機

代碼為:
// 此時的錯誤,應(yīng)該是帶了注釋 #,而導(dǎo)致的問題拋錯(即:去掉該注釋, 應(yīng)該就能解決該問題);

# Default github user self
Host github.com
	port 443 # 默認是22端口
	HostName ssh.github.com
	IdentityFile ~/.ssh/id_rsa

step2、拋錯: fatal: Could not read from remote repository.

要檢查下,此時配置里的 IdentityFile ~/.ssh/xxxxxxxxxxxxxxxxxx,后面跟的是不是想要的倉庫地址;

step3、如何查看 vim ~/.ssh/config 命令中的 config 配置文件:

// 此時說明:.ssh 文件與 work 文件同一等級,查看并修改即可(即:可以通過 Notepad ++ 工具);

解決 Git:ssh: connect to host github.com port 22: Connection timed out 問題的三種方案,# 前端所遇問題欄,git,ssh,github,經(jīng)驗分享,port 22,前端,虛擬機

4、小結(jié):

其一、哪里有不對或不合適的地方,還請大佬們多多指點和交流!
其二、若有轉(zhuǎn)發(fā)或引用本文章內(nèi)容,請注明本博客地址(直接點擊下面 url 跳轉(zhuǎn)) https://blog.csdn.net/weixin_43405300,創(chuàng)作不易,且行且珍惜!
其三、有興趣的話,可以多多關(guān)注這個專欄(Vue(Vue2+Vue3)面試必備專欄)(直接點擊下面 url 跳轉(zhuǎn)):https://blog.csdn.net/weixin_43405300/category_11525646.html?spm=1001.2014.3001.5482文章來源地址http://www.zghlxwxcb.cn/news/detail-822562.html

到了這里,關(guān)于解決 Git:ssh: connect to host github.com port 22: Connection timed out 問題的三種方案的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!

本文來自互聯(lián)網(wǎng)用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務(wù),不擁有所有權(quán),不承擔(dān)相關(guān)法律責(zé)任。如若轉(zhuǎn)載,請注明出處: 如若內(nèi)容造成侵權(quán)/違法違規(guī)/事實不符,請點擊違法舉報進行投訴反饋,一經(jīng)查實,立即刪除!

領(lǐng)支付寶紅包贊助服務(wù)器費用

相關(guān)文章

  • 【Git】ssh: connect to host github.com port 22: Connection refused

    【Git】ssh: connect to host github.com port 22: Connection refused

    錯誤原因:22端口被拒絕訪問 在~/.ssh/config文件(有就直接編輯,沒有就創(chuàng)建)里添加以下內(nèi)容,這樣ssh連接GitHub的時候就會使用443端口。 修改完,使用`ssh -T git@github.com`查看是否連接成功

    2024年02月04日
    瀏覽(19)
  • 【Git 教程系列第 27 篇】ssh: connect to host github.com port 22: Connection refused 的解決方案

    【Git 教程系列第 27 篇】ssh: connect to host github.com port 22: Connection refused 的解決方案

    這是【Git 教程系列第 27 篇】,如果覺得有用的話,歡迎關(guān)注專欄。 一:問題描述 自己的一個 git 項目,昨天在公司正常 push 的時候,提示文字信息如下 提示截圖信息如下 有人說是因為開了代理的原因,不過之前我開著代理提交是沒有問題的,但還是試了一試,可惜并沒有

    2024年02月08日
    瀏覽(26)
  • 解決 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: 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日
    瀏覽(27)
  • 解決ssh: connect to host github.com port 22: Connection refused

    ssh: connect to host github.com port 22: Connection refused 是連接github.com的端口號22拒絕連接。 可以使用github的443端口。 解決方案 在 ~/.ssh/config 中添加如下字段: 測試是否鏈接成功 如果出現(xiàn)如下字段則驗證成功 The authenticity of host ‘[ssh.github.com]:443 ([20.205.243.160]:443)’ can’t be establishe

    2024年01月22日
    瀏覽(30)
  • 如何解決:ssh: connect to host github.com port 22: Connection refused

    如何解決:ssh: connect to host github.com port 22: Connection refused

    問題: 進行g(shù)ithub操作時出現(xiàn)了下面的錯誤,如何解決 ? 排查思路: ssh: connect to host github.com port 22: Connection refused? 這個錯誤提示的是連接 github.com 的22端口被拒絕了??梢院唵卫斫鉃榇碎T不通,既然這個端口號走不通,那換一個端口號試試看。 解決方法一: 網(wǎng)上大多的解決

    2024年02月14日
    瀏覽(21)
  • 解決 ssh: connect to host github.com port 22: Connection timed out

    解決 ssh: connect to host github.com port 22: Connection timed out

    今天使用git克隆github上的代碼時,一直報錯 原以為是公鑰過期了,就嘗試修改配置公鑰,但是嘗試了幾次都不行,最終在博客上找到了解決方案,在次記錄一下,以備不時之需 解決ssh-connect-to-host-github-com-port-22-connection-timed-out_ssh connection time out-CSDN博客 找到.ssh文件夾,創(chuàng)建

    2024年01月24日
    瀏覽(19)
  • git報錯處理:ssh:connect to host github.com port 22: Connection timed out

    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日
    瀏覽(24)
  • Git推送到Guthub錯誤:ssh: connect to host github.com port 22: Connection refused

    可能是中國內(nèi)地網(wǎng)絡(luò)環(huán)境的原因,Git通過ssh推送到自己的存儲庫發(fā)生以下錯誤。大概是github.com的22端口被屏蔽了? 通過HTTPS也不行,以下錯誤提示大意是 2021-08-13 密碼認證被移除了。官方中文文檔 文檔里似乎沒說密碼認證被移除這回事 官方文檔: 在 HTTPS 端口使用 SSH 鏈接格

    2024年01月23日
    瀏覽(29)
  • Windows下解決ssh: connect to host github.com port 22: Connection refused

    Windows下解決ssh: connect to host github.com port 22: Connection refused

    今日在學(xué)習(xí)git操作的時候,往遠程庫github庫push代碼時報錯: 查閱網(wǎng)上資料,發(fā)現(xiàn)了這幾種做法: 方法一 也是網(wǎng)上大多數(shù)文章的做法,在C:UsersUsername.ssh目錄下新建一個config文件,文件內(nèi)容: 可不知為何我還是報錯了。。。 方法二 根據(jù)英文可以看出,ssh端口號被拒絕了,

    2023年04月08日
    瀏覽(29)
  • github 推送報錯 ssh: connect to host github.com port 22: Connection timed out 解決

    github 推送報錯 ssh: connect to host github.com port 22: Connection timed out 解決

    ?? 作者主頁: 有來技術(shù) ?? 開源項目: youlai-mall ?? vue3-element-admin ?? youlai-boot ?? 倉庫主頁: Gitee ?? Github ?? GitCode ?? 歡迎點贊 ?? 收藏 ?留言 ?? 如有錯誤敬請糾正! git push 推送 github 報錯如下: 找到 .ssh 文件夾新增 config 配置文件 添加以下配置即可 使用 ssh -T g

    2024年01月25日
    瀏覽(28)

覺得文章有用就打賞一下文章作者

支付寶掃一掃打賞

博客贊助

微信掃一掃打賞

請作者喝杯咖啡吧~博客贊助

支付寶掃一掃領(lǐng)取紅包,優(yōu)惠每天領(lǐng)

二維碼1

領(lǐng)取紅包

二維碼2

領(lǐng)紅包