Setting Up SSH Authentication with GitHub for Secure Access with 2FA GitHub Accounts
Creating SSH Keys
Type this in to create GitHub Keys for your computer
|
|
Notes:
- I typically save this in ~/.ssh/github
- You don’t have to put a password if you aren’t worried about security
Adding the New Key to GitHub and Local SSH-Agent
Type the following on the local machine to add your key to the agent.
|
|
Copy the contents of ~/.ssh/github.pub
to the new key field in GitHub. If you have xclip installed type this cat ~/.ssh/github.pub | xclip -sel clip
to copy the contents.
Test GitHub SSH Access
Type the following to verify you have completed the setup properly
|
|
SSH GitHub Clone Syntax and Updating Repositories
Here is how to clone new repositories instead of using https://
|
|
Update existing repositories to use SSH instead of https
|
|
Conclusion
This is the best way to clone and push updates to repositories if you have 2-Factor enabled on your GitHub account.
Chris Titus Tech
Social
- Twitter - https://twitter.com/christitustech
- YouTube - https://youtube.com/c/ChrisTitusTech
- Twitch - https://twitch.tv/christitustech
- Odysee / LBRY (Privacy) - https://links.christitus.com/lbry
Exclusive Content
- ChrisTitus.com Members Section (CC Only)
- Digital Downloads with Guides and Pre-Built Images
- Monthly Members Only Video
- $5 Per Month (100% of Proceeds goes to Chris Titus Tech)
- YouTube Chris Titus Tech Membership (All Payments Accepted)
- Monthly Members Only Video
- YouTube Emojis for Comments and Live Chat
- YouTube Badges that changes based on membership time for comments and chat.
- All YouTube comments are highlighted when I review comments daily.
- $4.99 Per Month (70% of the Proceeds goes to Chris Titus Tech)