github.com - how to set up ssh key usage under linux
So, after telling it a longer time, github has disabled it https authentication mechanism.
From now on, you have to use ssh keys and a configuration. Following is a simple how to do it.
First of all, generate your ssh key
#my advice, name the key to your usage
#e.g.: com_github_<yourusername>
ssh-keygen -t rsa -b 4096
Next up, you have to upload the pub key to github account.
After that, you have to adapt the ~/.ssh/config
file.
Host github.com
Hostname github.com
User git
PreferredAuthentications publickey
IdentityFile ~/.ssh/com_github_<yourusername>
This was the easy part. Now to the final step that took me ages. You have to go through all your repositories and check if you use ssh or http as the transport protocol to work with github.
Go to a repository and open up your .git/config
file.
Replace any thing that starts with https://github.com/...
with git@github.com:...
. It should only be in the lines starting with url =
.
After that git remote -v
should work fine. But yes, you have to do it for all repositories.
If you have to stick to use HTTPS operations (like working from behind a firewall where ssh port 22 is restricted), try to follow this guide to setup an access token per device.
- Open your developer settings new token page
- Give it a name like "work
" - Give it an expiration date
- select the scopes and permissions
- Click on
Generate token
- Update your credential manager
- e.g. Windows it is the clickpath
control panel -> credential manager -> generic credentials
- or for german windows users
systemsteuerung -> benutzerverwaltung -> eigene anmeldeinformationen verwalten -> windows-anmeldeinformationen -> github.com auswählen
- e.g. Windows it is the clickpath
Trackbacks
Die Kommentarfunktion wurde vom Besitzer dieses Blogs in diesem Eintrag deaktiviert.
Kommentare
Ansicht der Kommentare: Linear | Verschachtelt