How To Setup SSH key in WindowsLaravel
In this article, I show you how to set up SSH in windows10,
first of all, you have a question what is the ssh key, and why do we need it?
you can watch this video or follow an article.
Let me explain a bit more, An SSH key is a secure access credential used in the Secure Shell protocol. SSH keys use key pairs based on public key infrastructure technology, the gold standard for digital identity authentication and encryption, to provide a secure and scalable method of authentication. as you know all developers use git for pushing, fetching, and pulling their code from GitLab, GitHub, and any other tools.
So, using SSH key you can use git for your repository and get authentication from GitHub or any tool where you add ssh.
When you set up an SSH key, you create a key pair that contains a private key (saved to your local computer) and a public key.
So, Let's Set up SSH for Git on Windows
Step1: Set up your default identity
firs of all open your terminals like
- Now, type the command
ssh-keygenand enter and command prompts you for a file to save the key in:
$ssh-keygen Generating public/private rsa key pair. Enter file in which to save the key (/c/Users/emmap1/.ssh/id_rsa):
Press enter to accept the default key and path,
/c/Users/<username>/.ssh/id_rsa. or you can specify the path and then press enter.
Enter and re-enter a passphrase when prompted.
final out put in your terminal is look likes,
ssh-keygen Generating public/private rsa key pair. Enter file in which to save the key (/c/Users/shailesh/.ssh/id_rsa): Created directory '/c/Users/shailesh/.ssh'. Enter passphrase (empty for no passphrase): Enter the same passphrase again: Your identification has been saved in /c/Users/shailesh/.ssh/id_rsa. Your public key has been saved in /c/Users/shailesh/.ssh/id_rsa.pub. The key fingerprint is: e7:94:d1:a3:02:ee:38:6e:a4:5e:26:a3:a9:f4:95:d4 shailesh@InfyOm-PC
Let's navigate to path
cd /c/Users/shailesh/.ssh/and fire
lscommand for confirming file generated or not.
lscommand displays two files, one for the public key (for example id_rsa.pub) and one for the private key (for example, id_rsa) if successfully generated.
Step 2: Add SSH in Bitbucket.
- let's fire command
cat id_rsa.pubon the terminal and make sure you stay on the
- Now, you can see the key in the terminal. so, copy it and add it to bitbucket. click here for Github to add SSH to your account.
Step 3: Add the SSH key to the ssh-agent.
$eval ssh-agent into the terminal and you get output like
Agent pid 9795. 9765 PID may be different in your PC.
Step 4: Check Login in terminal
ssh -T email@example.com in your terminal and you can get output like
Warning: Permanently added the RSA host key for IP address '188.8.131.52' to the list of known hosts.
authenticated via ssh key.
You can use git to connect to Bitbucket. Shell access is disabled