Last active
July 3, 2021 03:10
-
-
Save Hrissimir/0878377769dd9ae3f58a16d30bcd021d to your computer and use it in GitHub Desktop.
GitHub: SetupSSH Instructions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. Check for exisiting keys using: | |
ls -al ~/.ssh | |
2. When none are existing you'll get: | |
ls: cannot access '/home/USER/.ssh': No such file or directory | |
3. Generate new ssh key: | |
ssh-keygen -t rsa -b 4096 -C "[email protected]" | |
4. Start the ssh-agent service: | |
eval "$(ssh-agent -s)" | |
5. Add the newly generated key to the agent: | |
ssh-add ~/.ssh/id_rsa | |
# if you get: `Permissions 0755 for '/home/user/.ssh/id_rsa' are too open.` | |
# run either of the following commands without `sudo`: | |
# - chmod 400 ~/.ssh/id_rsa # make it readable from the current user only | |
# - chmod 600 ~/.ssh/id_rsa # make it writable from the current user only | |
# run as last-resort if both of the above commands fail: | |
# - chmod 700 ~/.ssh && chgrp 545 ~/.ssh/id_rsa | |
6. Install xclip to be able to easily copy the key: | |
sudo apt-get install xclip | |
7. Copy the ssh key: | |
xclip -sel clip < ~/.ssh/id_rsa.pub | |
8. Add the key to GitHub: | |
Top-right -> Settings -> SSH & GPG keys -> New SSH key -> name the PC and paste the key | |
9. Enabling SSH connections over HTTPS: | |
sudo gedit ~/.ssh/config | |
Paste the following: | |
Host github.com | |
Hostname ssh.github.com | |
Port 443 | |
10. Check the connection: | |
ssh -vT [email protected] | |
NOTE: In order for this to work you need to clone your repo using the SSH link! (sample below) | |
git clone [email protected]:USERNAME/REPONAME.git |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment