Permission denied (publickey). fatal: Could not read from remote repository. Please make sure you h

Posted cuzz

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Permission denied (publickey). fatal: Could not read from remote repository. Please make sure you h相关的知识,希望对你有一定的参考价值。

第一次提交遇到这样的情况,怎么回事呢,我在github上提交了ssh key 的啊。

排查先看看能不能解析,

1.先 ping https://github.com  

把ip添加到 host :    sudo vi /etc/hosts  (添加下面第三行)

127.0.0.1  localhost  localhost.localdomain  VM-0-6-ubuntu
127.0.1.1       TENCENT
192.30.255.113  github.com # 添加ip

# The following lines are desirable for IPv6 capable hosts
::1     localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
192.30.255.113 github.com
~                         

2.如果不行的话看看自己有没有输入错误的创库地址

查看配置

cat .git/config

[core]
        repositoryformatversion = 0
        filemode = true
        bare = false
        logallrefupdates = true
[remote "origin"]
        url = git@github:cuzz1/flask.git   # 错误的
        url = git@github.com:cuzz1/flask.git
        fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
        remote = origin
        merge = refs/heads/master

3. 现在提交还出现

那就是github 上的ssh key 添加错了,我们用ssh-keygen -t rsa -C "xxxx@163.com" 会生成在很多目录下,比如root/.ssh、 /home/ubuntu/.ssh 都有ras_id.pub 

所以我们不能添加错了。必须在 ~/.ssh目录下  才有用,要是当前目录,把  ~/.ssh/ras_id.pub 拷到github上就可以了。

现在提交就可以了。

 

感谢军哥的帮忙 ,微信公众号 Python之禅

以上是关于Permission denied (publickey). fatal: Could not read from remote repository. Please make sure you h的主要内容,如果未能解决你的问题,请参考以下文章

mkdir(): Permission denied

git clone 报错 sign_and_send_pubkey: signing failed: agent refused operation Permission denied (public

mac使用ssh出现permission denied(publickey)

permission denied怎么解决

npm permission denied错误npm ERR! Error: EACCES: permission denied, access

怎么卸载numpy permission denied