Monday, September 20, 2021

Github and SSH

ssh-keygen -t ed25519 -f github.com

ssh-add ~/.ssh/github.com

# save the keys to the cloud or somewhere where you will not lose them


#Now make an ssh config file

# https://gist.github.com/rbialek/1012262
nano ~/.ssh/config

#Mac 
Host github.com
User git
        Hostname github.com
        PreferredAuthentications publickey
        IdentityFile /home/user/.ssh/github.com

# Ubuntu
Host github.com
User git
        Hostname github.com
        IdentityFile /home/<user>/.ssh/github.com

https://garywoodfine.com/use-pbcopy-on-ubuntu/

sudo apt-get install xclip -y

nano ~/.bashrc

# insert at the end of the .bashrc file

alias pbcopy='xclip -selection clipboard'

alias pbpaste='xclip -selection clipboard -o'

eval "$(ssh-agent -s)"

# save the file

source ~/.bashrc

# copy the public key to GitHub
# Mac
pbcopy < ~/.ssh/github.com.pub

https://docs.github.com/en/github/authenticating-to-github/connecting-to-github-with-ssh
# Adding a new SSH key to your GitHub account
# To configure your GitHub account to use your new (or existing) # SSH key, you'll also need to add it to your GitHub account.

eval "$(ssh-agent -s)"






# Now check the ssh connection

ssh git@github.com

# Setup two factor authentication

https://docs.github.com/en/github/authenticating-to-github/securing-your-account-with-two-factor-authentication-2fa/configuring-two-factor-authentication

Put an encryption key on Lastpass or some other password service

Use the key to encrypt the keys and recovery codes and move them to a Google Drive folder



No comments:

Post a Comment