git 权限被拒绝(公钥、gssapi-keyex、gssapi-with-mic)

标签 git ssh rsa

我有一个公钥/私钥 rsa key 对。我可以使用 ssh 连接到远程服务器,但是当我执行 git pull origin master 时,我收到此错误:

Permission denied (publickey,gssapi-keyex,gssapi-with-mic). fatal: Could not read from remote repository.

Please make sure you have the correct access rights and the repository exists.

我的 git 客户端运行 ubuntu 14.04,我的公私钥在文件夹 $HOME\.ssh 中。

我尝试执行 sudo chmod -R 777 folder 但没有成功。

最佳答案

sudo chmod -R 777 folder but without any success.

那是行不通的,因为任何具有写入权限的文件夹都会使 ssh 立即失败。

您需要确保:

  • 您已正确生成 ssh key 对:

    ssh-keygen -t rsa -b 4096 -C "your_email@example.com"
    

(我建议一开始不要设置密码,至少为了测试)

  • 与您的 ~/.ssh/id_rsa(.pub) 的正确关联是正确的。
    至少:

    chmod 700 /home/<login>/.ssh
    chmod 600 /home/<login>/.ssh/authorized_keys
    
  • ssh url 正确。
    例如,GitHub 将使用 git@github.com:user/repo

  • 您的 ssh key 已注册到您的帐户 (Example for GitHub)

关于git 权限被拒绝(公钥、gssapi-keyex、gssapi-with-mic),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37624386/

相关文章:

eclipse - EGit 删除了我的工作区

Git 无法添加文件

git - 通过 github API 获取存储库的所有者

python - 无法使用 Paramiko 从 exec_command 接收 ifconfig 数据

go - 在 circle ci 中使用 go mod 获取私有(private) repo

ios - Cocoapods/git 'detached HEAD' 状态

linux - 如何使用 ssh tail 命令写入本地文件

JAVA - 如何从 sqlite 数据库存储和读取 RSA 公钥

cryptography - 软件产品的许可证 key 生成方法

linux - 期望脚本处理 RSA 指纹 key