Github push error. Permission denied

gitgithub

I am just trying to create my first repo from Ubuntu 11.10 with this command:

I was about to finish sudo git push -u origin master

Permission denied (publickey).
fatal: The remote end hung up unexpectedly

How can this be fixed?

I tried this too. i.e git push -u origin master. I got this error.

error: could not lock config file .git/config: Permission denied
error: could not lock config file .git/config:
Permission denied
Branch master set up to track remote branch master from origin.
error: unable to create directory for .git/refs/remotes/origin/master
error: Cannot lock the ref 'refs/remotes/origin/master'.
Everything up-to-date

Best Answer

Could this be of any help?

Quote:

Did you forget to add your public key to the github project settings? Also check to make sure your private key is in your .ssh directory.

Goto https://github.com/[username here]/[project name here]/edit and make sure your public key is set.

Read this too: http://help.github.com/mac-key-setup/