Forked from MasterHans/PHPStorm connect to GitHub by SSH
Created
January 29, 2019 14:32
-
-
Save ser0ja/25da44131584ca156c73694f92bd75b8 to your computer and use it in GitHub Desktop.
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. Make Home Directory for SShH keys. | |
c://users/UserName/.SSH (for Windows 7) | |
2. Generate SSH key by command: | |
ssh-keygen -t rsa -C "[email protected]" | |
# Creates a new ssh key, using the provided email as a label | |
Generating public/private rsa key pair. | |
It's created a pair of keys - private and public in home dir .SSH | |
C:\Users\SuvorovAG\.ssh\id_rsa | |
C:\Users\SuvorovAG\.ssh\id_rsa.pub | |
3. You must creat file with a name "config" in SSH Home dir | |
touch ~/.ssh/config | |
4. Put the strings bellow to the config file by notepad for example | |
Host github.com | |
HostName github.com | |
Port 22 | |
IdentityFile /c/users/username/.ssh/id_rsa | |
6. Adding your SSH key to the ssh-agent | |
Ensure ssh-agent is enabled: | |
If you are using Git Bash, turn on ssh-agent: | |
# start the ssh-agent in the background | |
eval "$(ssh-agent -s)" | |
Agent pid 59566 | |
7. Add your SSH key to the ssh-agent. If you used an existing SSH key rather than generating a new SSH key, | |
you'll need to replace id_rsa in the command with the name of your existing private key file. | |
$ ssh-add ~/.ssh/id_rsa | |
8. And than you must copy to clipboard SSH link from your repository | |
[email protected]:sample-username/sample-repo.git | |
9. Clone your repository | |
git clone [email protected]:sample-username/sample-repo.git | |
10. Testing your SSH connection | |
Open Git Bash. | |
Enter the following: | |
ssh -T [email protected] | |
# Attempts to ssh to GitHub | |
Hi username! You've successfully authenticated, but GitHub does not | |
provide shell access. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment