Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
    User hg
    PreferredAuthentications publickey
    IdentityFile C:/Documents and Settings/Marek/.ssh/bb

Host github
    User git
    PreferredAuthentications publickey
    IdentityFile C:/Documents and Settings/Marek/.ssh/id_rsa 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?


share|improve this question

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.

share|improve this answer
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:… WTF? – drupality 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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .