I have repos in github and bitbucket.

First I wanted to use same public key in bb and gh with no luck.

So I created another public key, my .ssh/config file look like this:

Host bb
    HostName bitbucket.org
    User hg
    PreferredAuthentications publickey
    IdentityFile C:/Documents and Settings/Marek/.ssh/bb

Host github
    HostName github.com
    User git
    PreferredAuthentications publickey
    IdentityFile C:/Documents and Settings/Marek/.ssh/id_rsa

bb.pub is for bitbucket. I pasted key from this file to bitbucket.

I still having

Permission denied (public key)

when I try to push my initial commit. Could somebody help?



You should always use "git" and "hg" as the usernames for github and bitbucket, and not your own username. The public key itself will be used to identify you.

  • And this is likely his issue. Mine are 'hg' and 'git'. – lornix Jul 6 '12 at 23:39
  • It's just won't work, btw I found totally different conf example: confluence.atlassian.com/download/attachments/221449711/… WTF? – Codium Jul 7 '12 at 20:16
  • I am not sure that I get this answer. Can someone explain what we mean by use "git" and "hg" as the usernames? This is the very first time I am facing this Permission denied (public key) issue, and I never paid attention to the name of my ssh users... – Alexandre Bourlier Mar 28 '15 at 10:37
  • The answer is confusing because OP edited the question afterwards; he originally used "someuser" as the user, implying it was his own username. For implementation reasons, Github, BB, and git/hg-hosting solutions like Gitolite or Gitlab, let all ssh clients connect under to a special service account (typically named "git" or "hg"), and only enforce ACLs afterwards based on the identity of the key. This of course doesn't apply if you are hitting a repository on a system on which you have a full ssh account. – b0fh Mar 30 '15 at 21:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.