使用 Git 軟體,將檔案從遠端抓取下來 (git pull) 要更新本地電腦檔案時,遇到「Authentication failed」錯誤訊息,同時列了七個可能原因。改用另一套軟體,則顯示「ssh: connect to host gitlab.com port 22: Operation timed out」。確認是電腦目前連線使用的無線基地台防火牆有擋,改用其他網路連線方式解決。
Photo by Stijn Swinnen on StockSnap |
錯誤狀況
使用 Git 軟體,顯示「Authentication failed」錯誤,同時列了七個可能原因。
改試另一套 Git 軟體,則顯示「ssh: connect to host gitlab.com port 22: Operation timed out」比較明確的錯誤訊息。
使用 telnet 指令確認 port 22 的連線狀況,在終端機軟體輸入指令
telnet gitlab.com 22
過了幾分鐘,顯示 Unable to connect to remote host
可以確認原因在於目前連線使用的無線基地台的防火牆有擋 port 22。
解決方式
(1) 改用其他網路連線方式,例如原本是無線網路,改用其他無線熱點或者是有線網路。
如果切換其他網路連線方式不方便,則可以考慮:
(2) Git Clone 時,原本選擇檔案庫 (repository) Clone with SSH ,可以改用 Clone with HTTPS。
就可以順利使用 Git 指令。
驗證解決方式
使用 telnet 指令確認 port 22 的連線狀況,使用終端機軟體,輸入指令
telnet gitlab.com 22
備註
備註 1 Git 軟體 1 顯示的錯誤訊息文字:
Authentication failed. Some common reasons include:
- You are not logged in to your account: see GitHub Desktop > Preferences.
- You may need to log out and log back in to refresh your token.
- You do not have permission to access this repository.
- The repository is archived on GitHub. Check the repository settings to confirm you are
still permitted to push commits.
- If you use SSH authentication, check that your key is added to the ssh-agent and
associated with your account.
- If you use SSH authentication, ensure the host key verification passes for your repository
hosting service.
- If you used username / password authentication, you might need to use a Personal
Access Token instead of your account password. Check the documentation of your
repository hosting service.
備註 2 Git 軟體 2 顯示的錯誤訊息文字:
git -c color.branch-false -c color.diff=false -c color.status=false -c
diff.mnemonicprefix=false-ccore.quotepath=false-c credential.helper=sourcetree
fetch origin
ssh: connect to host gitlab.com port 22: Operation timed out
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
Completed with errors, see above
留言
張貼留言