Alex Bollbach
Alex Bollbach

Reputation: 4600

Configuring SSH to push to GitHub fails

I went through the process of generating ssh keys and submitting the public key to github. I was able to push to my github repo last night. But today at work I had to push to my company repo and perhaps that screwed something up because when I now go to push to the same repo I could push to last night I get

ERROR: Permission to ME/this-site-2017.git denied to myUserName.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

if I cat ~/.ssh/ I see:

github1 github1.pub (among other files)

I uploaded the public key to github last night and I still see it there.

So my question is what happened? Why do I no longer have permission?

Upvotes: 0

Views: 400

Answers (1)

Jakuje
Jakuje

Reputation: 26016

The authentication key does not need to be only in ~/.ssh, but ssh needs to know about it, for example using configuration file ~/.ssh/config:

Host github.com
  IdentityFile ~/.ssh/github1

Upvotes: 3

Related Questions