git Permission denied(publickey,gssapi-keyex,gssapi-with-mic) [英] git Permission denied (publickey,gssapi-keyex,gssapi-with-mic)

查看:5037
本文介绍了git Permission denied(publickey,gssapi-keyex,gssapi-with-mic)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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


权限被拒绝(publickey,gssapi-keyex,gssapi-with-mic)。致命:
无法从远程存储库读取。



请确保您拥有正确的访问权限并存在存储库


我的git客户端运行 ubuntu 14.04 ,我的公用私钥位于文件夹



我试着做 sudo chmod -R 777 folder code>但没有任何成功。

解决方案


sudo chmod -R 777文件夹任何成功。

这绝不会奏效,因为任何具有写入权限的文件夹都会使ssh立即失败。



您需要确保:您已生成 ssh密钥对正确:

  ssh-keygen -t rsa -b 4096 -Cyour_email@example.com




(我推荐不是首先设置密码短语,至少用于测试)




  • 与您的〜/ .ssh / id_rsa(.pub)正确关联是正确的。

    At至少:

      chmod 700 /home/<login>/.ssh 
    chmod 600 / home /< login> ; /。ssh / authorized_keys


  • ssh url正确。

    例如,GitHub将使用git@github.com:user / repo


  • 您的ssh密钥已注册到您的帐户( GitHub示例



I have a public/private rsa key pair. I can connect to remote server with ssh, but when I do git pull origin master I get this error:

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.

My git client run ubuntu 14.04 and my public private key is in the folder $HOME\.ssh.

I tried to do sudo chmod -R 777 folder but without any success.

解决方案

sudo chmod -R 777 folder but without any success.

That would never work, as any folder with writing right would make ssh fail immediately.

You need to make sure that:

  • you have generate the ssh key pair properly:

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

(I recommend not setting a passphrase at first, at least for testing)

  • the right associate with your ~/.ssh/id_rsa(.pub) are correct.
    At least:

    chmod 700 /home/<login>/.ssh
    chmod 600 /home/<login>/.ssh/authorized_keys
    

  • the ssh url is correct.
    For instance, GitHub would use git@github.com:user/repo

  • your ssh key is registered to your account (Example for GitHub)

这篇关于git Permission denied(publickey,gssapi-keyex,gssapi-with-mic)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆