I've recently set up a git repository on Win10 via Cygwin and now I'm trying to make it track a remote repo on github.
The problem is, that after adding a remote like this:
git remote add github-remote git@github.com:username/github-remote.git
I cannot access it in any possible way (pushing, fetching, displaying additinal info by 'show'). All I get is this:
git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights and the repository exists.
Although I know this topic's been discussed a lot, none of the solutions I found actually helped. That's why I decided to post yet another question.
Here's what I did, step-by-step:
1) Generated the pub-priv keypair:
ssh-keygen -t rsa -b 4096 -C "mymail@ex.com"
Tried with both - a default and a custom directory for the id_rsa files. Same results.
2) Ran the ssh agent (or checked for it running, to be precise):
eval $(ssh-agent -s)
3) Added the key to the agent
ssh-add ~/.ssh/id_rsa
4) Copied the id_rsa.pub to github
5) Checked if the connection's set properly
ssh -T git@github.com
... with a promising result of
You've successfully authenticated, but GitHub does not provide shell access.
From what I learned this error may be due to git's address not being included in the /.ssh/known_hosts file. The thing is (as far as I know) that it is being inserted automatically e.g. with 'ssh -T' so I doubt it's the case, either. Although tried that as well:
ssh-keyscan -t rsa github.com | ssh-keygen -lf -
Another possible problem could be my private key's access being available too widely for the users, but I checked that, too.
With all that said I have no further idea how to fix this one, so I'd appreciate any help. Thank you in advance.