Home > Net >  Why I can't connect to github.com using ssh?
Why I can't connect to github.com using ssh?

Time:10-17

I want push my branch onto my github account. I have created ssh key, so I can connect via ssh:

rkukushkin@krv76-home:~/qtprojects$ ssh [email protected]
PTY allocation request failed on channel 0
Hi krv76! You've successfully authenticated, but GitHub does not provide shell access.
Connection to github.com closed.

but when I'm trying git push I got the following:

rkukushkin@krv76-home:~/qtprojects$ git push origin master
Username for 'https://github.com': krv76
Password for 'https://[email protected]': 
remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/krv76/signal.git/'

I expect connection without checking my username and password.

What I'm forget or what I'm doing wrong?

CodePudding user response:

You need to set the remote URL to use the ssh protocol, not the https protocol.

When you go to GitHub, the "Code" button lets you pick the protocol: choose "SSH" (snapshot arbitrarily taken from the git-reference repo):

enter image description here

When you clone your repo, use that URL in the first place. But since you've already cloned with https, you can change the remote url now like this (guessing your URL from your error log):

git remote set-url origin [email protected]:krv76/signal.git

CodePudding user response:

git remote -v will display url of the repository hosting your code inorder to connect to the remote via ssh your url should be of the form [email protected]:krv76/catboost.git you can use git remote add to add a new remote or the various subcommands of git remote to play around with remotes that your local clone is aware of https://git-scm.com/docs/git-remote

  • Related