DEV Community

Cover image for Switch To Token Based or SSH Based Authentication on Github Before 13th August 2021
Saadman Rafat
Saadman Rafat

Posted on • Edited on

Switch To Token Based or SSH Based Authentication on Github Before 13th August 2021

Github is about to change how we interact and work with Git forever. In a blog post published in December 2020, Github announced its plans to move to a token-based authentication system by August 2021. To avoid any unwarranted disruptions, make the switch now.

Generate a personal access token from Developer Settings. If you are using Linux. Install gh, that's github's command-line tool.

$ sudo snap install gh
Enter fullscreen mode Exit fullscreen mode

Switch to Token-Based Authentication on Github. Generating personal access token

After you are done generating the token paste it on the gh auth login prompt.

~$ gh auth login
? What account do you want to log into? GitHub.com
? You're already logged into github.com. Do you want to re-authenticate? Yes
? What is your preferred protocol for Git operations? SSH
? Upload your SSH public key to your GitHub account? Skip
? How would you like to authenticate GitHub CLI? Paste an authentication token
Tip: you can generate a Personal Access Token here https://github.com/settings/tokens
The minimum required scopes are 'repo', 'read:org'.
? Paste your authentication token: 
Enter fullscreen mode Exit fullscreen mode

SSH Based Authentication Token

You can authenticate by pasting the secret auth token, or authenticate using the browser which is a lot easier. Another and rather most common way to authenticate is by using SSH Based authentication token.

$ gh ssh-key add -t name ~/.ssh/id_rsa.pub
Enter fullscreen mode Exit fullscreen mode

Troubleshooting

If you are still having issues setting up either of the authentication tokens try updating the client. Read official blog post, provides a comprehensive installation plan for any OS you might be using.

I'll try to do a step my step video on Youtube. Post your feedback's on the comments below.

Thanks

Top comments (0)