开发者

osx ssh/get wrong key?

开发者 https://www.devze.com 2023-02-17 12:33 出处:网络
At some point I have created a key which I creatively named publickey. I don\'t know where that is now and 开发者_运维百科I can\'t remember how I set git to use it.

At some point I have created a key which I creatively named publickey.

I don't know where that is now and 开发者_运维百科I can't remember how I set git to use it.

But when I try to use ssh I get:

mymac:joyent aaa$ git push mysite

Permission denied (publickey).

I've followed the github guide to set up new keys: http://help.github.com/mac-set-up-git/

I set my remote key information based on that, the new id_rsa key I made.

But whenever I try to push I end up using the old public-key. Even commits locally are with the wrong user.

How do I get rid of my old key and use my new one?


Even commits locally are with the wrong user.

That is not ssh related. Look at your /Users/harry/.gitconfig to set the username.

And look at this FAQ about explicitly setting which SSH identity to use.


I will say a few things you might already have realised if you have set up a new key with github but at least we will both know where you are at.

When generating a key you should get a private key, for example id_rsa and a public key id_rsa.pub (thats the one you pass to github)

Your local copy of git will probably be retrieving the key from your ~/.ssh (unless configured otherwise)

The publickey error your seeing doesn't necessarily mean the key is named publickey as I believe this is a standard error

So I would guess git isn't using your old key it's just got a problem with your current key. You should therefore check it is in the write location ~/.ssh and that the ~ is the ~ git is expecting, though you are working on mac so it should be and check you have copied your public key to github correctly, you need to paste the whole file

EDIT:

You can test your key with

ssh git@github.com 

And it should say you are authenticated to use if the keys are set up correct

0

精彩评论

暂无评论...
验证码 换一张
取 消