本地往遠(yuǎn)程倉庫推送時(shí)報(bào)錯
起因公司給配的電腦壞了,但是蘋果的iCloud可以同步,在新電腦上一番配置后,發(fā)現(xiàn)本地的代碼沒法推到遠(yuǎn)程倉庫:
做過的一些配置:
- 本地倉庫的遠(yuǎn)程倉庫地址
- ssh密鑰對
- 在遠(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”