- Generate the ssh key
cd .ssh
ssh-keygen -t ecdsa-sk -C “your_email@example.com”
the key will be generated and stored in .ssh (2 files example key_name and key_name.pub)
cat key_name.pub and copy the string returned.
2. Log into your github account and go to Settings/SSH and GPG Keys
3. Click on New SSH key
4. Give a name for the key and paste into the box below
5. Click on Add SSH key
6. On the computer, open .ssh/config and insert the following lines
sudo nano .ssh/config
Host *
AddKeysToAgent yes
IdentityFile ~/.ssh/key_name
CTRL+x Yes to save the file
7. Check you can connect to Github by running:
ssh -T git@github.com
If everything goes well, github will respond with your username and notify you that you cannot ssh into Github.
8. To clone a repository run the following command:
git clone https://github.com/username/repository_name
9. To avoid github to systematically ask for username and token when doing a git push, run the following command:
git config credential.helper store
The first ‘git push’ command will request for username and token but will store them in the cache for future usage of git push command.
10. Generation and usage of token
Log into your github account. On the top right Icon, select Settings, then (in the left column) select Developer Settings. The select Personal Access Token, Tokens (Basic). Here, you will see the list of existing token with the possibility to modify the parameters related to a chosen token, or the possibility to regenerate the token, and so on …