美文网首页gitlab/github
推送远程仓库(github/gitlab) 报错:Host ke

推送远程仓库(github/gitlab) 报错:Host ke

作者: 飞跑的蛤蟆 | 来源:发表于2020-09-14 20:21 被阅读0次

本地往远程仓库推送时报错

起因公司给配的电脑坏了,但是苹果的iCloud可以同步,在新电脑上一番配置后,发现本地的代码没法推到远程仓库:

做过的一些配置:

  1. 本地仓库的远程仓库地址
  2. ssh密钥对
  3. 在远程仓库上github/gitlab上也已经添加了本地密钥

报出以下的错误:

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 待确认时输入yes

参考文档:
Git SSH配置无误 但无法连接github远程仓库 “Host Key Verification Failed”

相关文章

网友评论

    本文标题:推送远程仓库(github/gitlab) 报错:Host ke

    本文链接:https://www.haomeiwen.com/subject/sgdbektx.html