Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.2k views
in Technique[技术] by (71.8m points)

ssh - git Permission denied (publickey,gssapi-keyex,gssapi-with-mic)

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...