Homan
Homan

Reputation: 26718

ssh keys and github prompting for password

I had my ssh keys generated in the .ssh folder in my home directory and could push and pull from github without problem.

Now I have a new computer and I zipped up and copied my .ssh folder to the new computer.

So now the setup should be the same on the new mac. However when I do push, pull, fetch to and from github, I get prompted for my username and password.

It's the same .ssh folder on my old mac and that computer works fine. Why does my new computer prompt me each time if the key is installed?

Upvotes: 1

Views: 827

Answers (2)

Adam Dymitruk
Adam Dymitruk

Reputation: 129566

As you said, the url has to be ssh+git for your ssh keys to be in effect. However, do not copy private keys from machine to machine. This is a very bad practice. Generate a new set of keys on a different machine and upload the public key to git hub. That's why multiple keys are supported on GitHub and other ssh enabled sites. Use that.

Upvotes: 0

Homan
Homan

Reputation: 26718

Ok, it turns out when I cloned the repo on my new machine that somehow the origin was set to use https version instead of the [email protected]:reponame url. Once I fixed that, it stopped prompting me.

Upvotes: 1

Related Questions