Git - 权限被拒绝(公钥) [英] Git - Permission denied (publickey)

查看:945
本文介绍了Git - 权限被拒绝(公钥)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Mac Snow Leopard上安装了git。



我刚试过

  git clone git@thechaw.com:cakebook.git 

但那给我这个错误。

 
在`/ Users / username / Documents / cakebook / .git /`中初始化了空的Git仓库
Permission denied(publickey) 。
致命:远程终端意外挂断

我缺少什么?

我也是尝试做 ssh-keygen ,但没有通过相同的错误。

解决方案

此信息正在使用TheChaw,但可以应用于所有其他支持SSH pubkey身份验证的git存储库。 (请参阅 gitolite ,例如gitlab或github。)


首先设置您自己的公钥/私钥对。这
可以使用DSA或RSA,所以基本上你设置的任何密钥都可以工作。
在大多数系统上,您可以使用ssh-keygen。


  • 首先,您需要将CD放入.ssh目录。打开终端并运行:


    cd〜/ .ssh&& ssh-keygen



  • 接下来,您需要将其复制到剪贴板。


    • 在OS X上运行: cat id_rsa.pub | pbcopy

    • 在Linux上运行: cat id_rsa.pub | xclip

    • 在Windows上(通过Cygwin / Git Bash)运行: cat id_rsa.pub |


    • 通过网站将您的钥匙加入您的帐户。

    • 最后设置你的.gitconfig。


      • git config --global user.namebob

      • git config --global user.email bob @ ...
        (不要忘记重新启动您的命令行以确保配置被重新加载)




    这就是你应该很好的克隆和结帐。

    >

更多信息可以在 https://help.github.com/articles/generating-ssh-keys (感谢@惠特尼)


I'm on Mac Snow Leopard and I just installed git.

I just tried

git clone git@thechaw.com:cakebook.git

but that gives me this error.

Initialized empty Git repository in `/Users/username/Documents/cakebook/.git/`
Permission denied (publickey).
fatal: The remote end hung up unexpectedly

What am I missing?
I've also tried doing ssh-keygen with no passphase but still same error.

解决方案

This info is working on theChaw but can be applied to all other git repositories which support SSH pubkey authentications. (See gitolite, gitlab or github for example.)

First start by setting up your own public/private key pair set. This can use either DSA or RSA, so basically any key you setup will work. On most systems you can use ssh-keygen.

  • First you'll want to cd into your .ssh directory. Open up the terminal and run:

    cd ~/.ssh && ssh-keygen

  • Next you need to copy this to your clipboard.
    • On OS X run: cat id_rsa.pub | pbcopy
    • On Linux run: cat id_rsa.pub | xclip
    • On Windows (via Cygwin/Git Bash) run: cat id_rsa.pub | clip
  • Add your key to your account via the website.
  • Finally setup your .gitconfig.
    • git config --global user.name "bob"
    • git config --global user.email bob@... (don't forget to restart your command line to make sure the config is reloaded)

Thats it you should be good to clone and checkout.

Further information can be found on https://help.github.com/articles/generating-ssh-keys (thanks to @Lee Whitney)

这篇关于Git - 权限被拒绝(公钥)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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