推送遠(yuǎn)程倉庫(github/gitlab) 報(bào)錯:Host key verification failed. fatal: Could not read from remote repository.

本地往遠(yuǎn)程倉庫推送時(shí)報(bào)錯

起因公司給配的電腦壞了,但是蘋果的iCloud可以同步,在新電腦上一番配置后,發(fā)現(xiàn)本地的代碼沒法推到遠(yuǎn)程倉庫:

做過的一些配置:

  1. 本地倉庫的遠(yuǎn)程倉庫地址
  2. ssh密鑰對
  3. 在遠(yuǎn)程倉庫上github/gitlab上也已經(jīng)添加了本地密鑰

報(bào)出以下的錯誤:

Please make sure you have the correct access rights
and the repository exists.
> git ls-tree -l HEAD -- /Users/username/Documents/github/docker_env/python/requirements.txt
> git show --textconv HEAD:python/requirements.txt
> git status -z -u
> git symbolic-ref --short HEAD
> git rev-parse master
> git rev-parse --symbolic-full-name master@{u}
> git rev-list --left-right master...refs/remotes/origin/master
> git for-each-ref --sort -committerdate --format %(refname) %(objectname)
> git remote --verbose
Warning: Failed to watch ref '/Users/username/Documents/github/docker_env/.git/refs/remotes/origin/master', is most likely packed.
> git config --get commit.template
> git ls-tree -l HEAD -- /Users/username/Documents/github/docker_env/python/requirements.txt
> git fetch
> git ls-tree -l HEAD -- /Users/username/Documents/github/docker_env/python/requirements.txt
> git show --textconv HEAD:python/requirements.txt
Host key verification failed.
fatal: Could not read from remote repository.

解決辦法:

方法一:
ssh-keyscan -H github.com >> ~/.ssh/known_hosts

方法二:
ssh -T git@gitlab.com 待確認(rèn)時(shí)輸入yes

參考文檔:
Git SSH配置無誤 但無法連接github遠(yuǎn)程倉庫 “Host Key Verification Failed”

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

友情鏈接更多精彩內(nèi)容