Permission denied (publickey).

Issue #3292 resolved
Former user created an issue

I'm trying to clone a repository using this command:
sudo git clone

I'm getting the following error:
Cloning into slimming-stem...
Permission denied (publickey).
fatal: The remote end hung up unexpectedly

The public key under my /home/username/.ssh/
seems to be the same as the one I've added to my account settings so I'm not sure why I'm getting denied.


Comments (5)

  1. Charles McLaughlin

    By using sudo ssh will look for root's keys, not yours in /home/username/.ssh/. You probably shouldn't be running git with sudo. But if you really need to, generate some new keys under the root account and upload those to Bitbucket.

  2. Mikael Brandt

    Thanks dudes, this ended my headache! I was getting positive results when using "ssh -T" but as soon as I tried to make the initial push of an old repo to remote it gave me this error. I am so glad I found this issue ticket, since it turned out that problem was that I have been using a bash alias to map "git" to "sudo git".

    So thanks a lot for pointing this out!

  3. Log in to comment