Mike Dent
Mike Dent

Reputation: 9

Trouble with GitHub and ssh keys?

From one of my hosts I can authenticate with ssh to GitHub, from another I cannot [email protected]: Permission denied (publickey).

I was having some issues from my Mac creating a new repo and pushing to it, I always got a permission denied error. However from my Linux host it worked fine.

I checked the repos for deploy keys (in case this was causing the issue), none of my repos had a deploy key set. I checked the keys on GitHub and there was only one ssh key installed. I deleted this key and tested, as expected the repos from the Linux host could not connect, yet the Mac could still connect.

From the Mac: ssh -T [email protected] Hi mcdent/blog1! You've successfully authenticated, but GitHub does not provide shell access. bash-3.2$

From Linux: [mike@docker1 doing]$ ssh -T [email protected] [email protected]: Permission denied (publickey). [mike@docker1 doing]$

I'm puzzled as to how the Mac is still authenticating? I likely did have a repo called blog1 in the past but I certainly don't now. Ideally I'd like to have a single key used on GitHub, which I can use with both my Linux and MacOS hosts.

Any pointers very welcome.

Upvotes: 0

Views: 255

Answers (1)

VonC
VonC

Reputation: 1328602

I'm puzzled as to how the Mac is still authenticating?

Then try a ssh -Tv [email protected].
You will see which key file is accessed and used for this authentication.
It should be a private key whose public key is registered to your account.

Check your environment variables or git config --global / git config --system -l for anything including blog1.

Upvotes: 0

Related Questions