1

I using the following command to create SSH key in git

$ ssh-keygen -t rsa -b 4096 -C "[email protected]"

on git bash, but when I enter this command on bash it is displaying another command list and not generate SSH Key. Then how can I generate Key?

3
  • 2
    Please provide the output you're getting. Commented May 17, 2019 at 14:31
  • it is some kind of other command manuals. difficult to copy all one is this ssh-keygen -p Commented May 17, 2019 at 14:39
  • Did you literally include $ in your command? You should not, that $ is a prompt that bash displays. The command you type should start with ssh-keygen… Commented May 17, 2019 at 15:41

4 Answers 4

3

Create your ssh key using ssh-keygen -o -t rsa -b 4096 -C "[email protected]"

After list file in folder ~./ssh and see if your key exist. Use:

ls ~/.ssh/

Sign up to request clarification or add additional context in comments.

Comments

1

To Generate ssh:

Step 1:

ssh-keygen -t rsa -b 4096 -C "[email protected]"

Replace it with Your Mail id

Enter passphrase if you want you can leave this blank

Step 2:

eval $(ssh-agent -s)

You will get Agent pid (Don't Need to copy it)

Step 3:

ssh-add ~/.ssh/id_rsa

Step 4:

cat < ~/.ssh/id_rsa.pub

Copy Down the Displayed key including your mail id

Then Goto Github > Settings > SSH And GPG keys > Click New RSA(Green Button) > Give a random title to the key and paste down the key below Tap Add SSH Key.

Comments

0

Using SSH (Secure Shell) instead of https seems the Secure & Fastest method. Just providing few links and tips here to make things a bit easy. You can check this step-by-step guide! provided by docs.github to "Check existing SSH keys, Generate, Add a new SSH key to your GitHub account, and more."

Tip #1: During the process you need to confirm SSH key fingerprints to validate the connection. Compare the key of the algorithm you chose respectively (RSA, ECDSA, or Ed25519) and confirm it. Check this link to compare the key: GitHub's public key fingerprints!

Tip #2: If you don't want to type passphrase every time you push, just press enter when it prompts to choose passphrase.

CAUTION: Other methods using https $ git config credential.helper store etc., even with using 'timeout' might seem faster but are 100% unencrypted and hence not secure. However, you can encrypt that config file and just decrypt it before use, but there is still a chance we might forget to encrypt it again after use. You can use it at your discretion.

Comments

0

ssh-keygen -t ed25519 -C "your_github_email_address"

dont write any passphrase, so enter

Overwrite (y/n)? y
Enter passphrase (empty for no passphrase): enter
Enter same passphrase again: enter

pbcopy < ~/.ssh/id_ed25519.pub
cd ~/.ssh
cat id_ed25519.pub 

and copy the content to github

ssh-..e9 AAA...+T5 [email protected]

https://medium.com/codex/clone-github-private-repository-using-ssh-on-mac-acc9110d1cfe

Crea o edita el archivo ~/.ssh/config para gestionar múltiples claves SSH o para asegurarte de que estás usando la clave correcta. Si no tienes un archivo de configuración, puedes crear uno.

nano ~/.ssh/config

Añade la configuración adecuada. Por ejemplo:

Host github.com
  HostName github.com
  User git
  IdentityFile ~/.ssh/id_ed25519

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.