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've just lost a bunch of repositories from my disk, so I've cloned them from GitHub. These are now asking for username and password each time I push something to GitHub. Those that haven't been deleted don't do that.
The only solution I've read for getting rid of username/password prompt is generating ssh key. The thing is I already have a key, otherwise I couldn't push without prompts in those repos, that I didn't clone.

I've looked at git config for two of my repositories, one that I can push without password and one that I've cloned. The only difference was branch.master.remote and branch.master.merge settings, which I unset, making git config the same. But the prompt is still there.

I'm not even sure that generating new ssh key will work. What are my options?

share|improve this question
Please see and give more details. What happens when you try to SSH? – user89272 Dec 3 '11 at 2:37
up vote 20 down vote accepted

My guess:

Your old repositories used SSH remotes ( or ssh:// prefixes), which used public-key authentication. (In fact, the Github SSH server never asks for a password.)

Your new repositories use HTTP remotes (, which only support password-based HTTP Basic authentication and do not use your SSH keys.

Change your remote URLs to use SSH again. Use git remote set-url or edit .git/config to do this. Replace

with just

You can even have an entry in your ~/.gitconfig that tells git to translate remote URLs from HTTP or Git to SSH.

This way, if your repository is configured for a HTTP or Git remote, git will ignore that setting when pushing and will use SSH instead.

[url ""]
    pushInsteadOf = git://
    pushInsteadOf =

(An insteadOf = setting is also possible, to override both pulling and pushing.)

share|improve this answer
Yes, that was it! Thanks! – usr Dec 3 '11 at 14:02

You must log in to answer this question.

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