Git - Permission denied (publickey)

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

I just tried

git clone

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 for 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.

  • But first you want to make sure you 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 OSX run: cat | pbcopy
    • On Linux run: cat | xclip
  • Add your key to your account via the website.
  • finally setup your git config
    • git config --global "bob"
    • git config --global 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 (thx to @Lee Whitney)