Problem installing git's 2FA

I am working with Linux openSUSE 15.3, an almost fresh installation from scratch. I want to use git via SSH without installing further apps.

I can login to https://github.com/ as MiHuf after entering the verification code sent to be via E-Mail.

~/.ssh contains these files: config id_ed25519 id_ed25519.pub known_hosts. config contains (among others):
Host github.com
User git
HostName ssh.github.com

I can connect with ssh -T git@github.com
Hi MiHuf! You’ve successfully authenticated, but GitHub does not provide shell access.

I have also created an gpg key and entered both keys on the page https://github.com/settings/keys.

On the page https://github.com/settings/security I read “Two factor authentication is not enabled yet.” When I click the button to enable 2FA I come to https://github.com/settings/two_factor_authentication/setup/intro. There I am lost. Where can I set SSH authentication???

SSH and 2FA are separate things: You can use SSH for Git operations (push and fetch/pull), 2FA is relevant for logging in on the website.

Considering that ssh -T git@github.com it seems you have already successfully set up SSH. In case you need to change anything, the relevant section in the user settings is called “SSH and GPG keys”.

To actually use SSH for Git operations you need to set the remote URL for your repositories to use SSH. You can find the right URL for a specific repository behind the green “Code” button on the repository page, it should have the form git@github.com:user/repo.git. Once you have the right URL, you can do something like this to set the URL (assuming origin is the remote name you use for the GitHub repo):

git remote set-url origin git@github.com:user/repo.git

Hello,

it works !!! Thank you very much for your help.

Michael

1 Like