Git, how to generate public key

前端 未结 3 1432
梦谈多话
梦谈多话 2020-12-13 01:15

how to generate a public key(to be used in GitHub/GitLab) using command line [Git Bash].

The command below generates the error sh.exe\": syntax error near une

相关标签:
3条回答
  • 2020-12-13 01:41

    The command to run is only

    ssh-keygen -t rsa -C "you@example.com"
    

    All the rest beginning with line 2 of your script is the output of ssh-keygen.

    And replace you@example.com with your email address.

    Have a look at the manual for ssh-keygen to look for additional options. You should probably use a longer key by adding -b 4096 to the option list.

    0 讨论(0)
  • 2020-12-13 01:43

    Here is the command

    ssh-keygen -t rsa -b 4096 -C "[your github's email]"
    # Creates a new ssh key
    # Generating public/private rsa key pair.
    

    This will generate a key for you.You have to copy that and insert into your Github's account (just one time).

    Steps how to do It

    0 讨论(0)
  • 2020-12-13 01:59

    Solution: ssh-keygen -t rsa

    Explanation : ssh-keygen is a tool for creating new authentication key pairs for SSH. Such key pairs are used for automating logins, single sign-on, and for authenticating hosts

    (for example cloning project from your private repo on Github straight to your aws machine).

    Options: You can perform more complicated operations and using flags in order to generate a tailor-made key according to your use case, extended functionality are more powerful and secured. The basic flags are: bits (Large integers making the the RSA key be less vulnerable and hard to crack), passphrase (similar to password) , type (dsa/ecdsa/ed25519/rsa) , comment for the specific ssh token (email or user name) and output key (default store on ~/.ssh/ path)

    Synopsis: ssh-keygen [-q] [-b bits] [-t dsa | ecdsa | ed25519 | rsa] [-N new_passphrase] [-C comment] [-f output_keyfile]

    Example:

    ssh-keygen -b 4096 -t rsa -n "tHiSiaPasSWoRd" -c "johnDoe@gmail.com" -f ~/.ssh/id_rsa
    
    0 讨论(0)
提交回复
热议问题