Forums

Connecting to GitHub

Hi there,

I seem to be having trouble pushing my git to Github

I get the following error

~/dr (main)$ git push -u origin main

Permission denied (publickey).

fatal: Could not read from remote repository.

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

I already created an ssh-keygen by doing ssh-keygen -t rsa I then copied the id_rsa.pub into GitHub's SSH access key

My origin is: github@github.com:<username>/<repository>.git

Not sure whats wrong.

I also want to note that I did test the connection and it seemed to work:

00:05 ~/dr (main)$ ssh -T git@github.com

Enter passphrase for key '/home/PardyCo/.ssh/id_rsa':

Hi PardyCo! You've successfully authenticated, but GitHub does not provide shell access.

Looking for some help :)

Make sure that you've configured the remote origin with the correct username and the correct repository and check that you have push permissions for the repository (either that it is one that you own or that you are a collaborator on the repository). Github have extensive troubleshooting help: https://docs.github.com/en/github/authenticating-to-github/troubleshooting-ssh

Hi glenn.

Thanks for the reply.

I guess the proper origin starts with git not github:

git@github.com:<username>/<repository>.git

That fixed it. (I was going off outdated information I guess)

Glad you got that working!