How to use SSH key to commit as collaborator on GitHub?

5

I'm a collaborator on a private Github repo (owned by someone else), and although I have added an SSH key to my own GitHub account which allows me to authenticate when accessing my own repositories, it always asks me for my password when I try to access the repository on which I am only a collaborator.

Do you have any idea why it doesn't authenticate me with my SSH key?

I have tried to add my key as a "deploy key" to the shared repo itself, but GitHub always rejects my submission, with the error message "Key is already in use.".

My remote looks like the following:

$ git remote -v
origin  https://example-user@github.com/example-owner/example-project.git (fetch)
origin  https://example-user@github.com/example-owner/example-project.git (push)

JellicleCat

Posted 2014-10-16T15:54:40.120

Reputation: 1 721

1Are you trying to push code trough ssh? How does link to your temote look like? – mpm – 2014-11-01T12:53:47.197

Added remotes above. – JellicleCat – 2014-11-03T20:45:09.587

Answers

6

You've added the github repo as HTTPS instead of via SSH, your URL should look something like this

git@github.com:example-owner/example-project.git

If you check the right of the repo on github, you should see options to get the links via HTTPS, SSH, or subversion.

peter

Posted 2014-10-16T15:54:40.120

Reputation: 542