Skip to content

Instantly share code, notes, and snippets.

@adyjs
Last active May 23, 2019 11:55
Show Gist options
  • Save adyjs/96bb69f41ab1172bab5df06b3978b2d0 to your computer and use it in GitHub Desktop.
Save adyjs/96bb69f41ab1172bab5df06b3978b2d0 to your computer and use it in GitHub Desktop.

Revisions

  1. adyjs revised this gist May 23, 2019. 1 changed file with 20 additions and 1 deletion.
    21 changes: 20 additions & 1 deletion gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -3,22 +3,41 @@ steps for setting SSH key on Github and localhost
    ---------------------------------------------------------
    1. generate SSH key on localhost ~/.ssh/ssh_key_folder

    https://help.github.com/en/enterprise/2.16/user/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent#generating-a-new-ssh-key


    2. if there is more than 1 Github account ,
    then need to setting "config" file in ~/.ssh folder

    https://gist.github.com/adyjs/902805f51b7163181046b9158616e368


    3. activate ssh-agent for add private SSH key
    $ eval "$(ssh-agent -s)"
    (if it's works , will see agent pid like this.)
    > Agent pid 59566


    4. using ssh-add command to

    (a.) delete cached key
    $ ssh-add -D

    (b.) add new private key
    $ ssh-add ./ssh_key_folder/private_key (usually default named "id_rsa")

    (c.) list and check added key

    $ ssh-add -l


    5. go Github website and login ,
    then adding SSH key


    6. cat ~/.ssh/ssh_key_folder/id_rsa.pub
    copy public SSH key , then paste on Github


    7. test it ,
    clone and push any repo for ensure everything works fine.

  2. adyjs created this gist May 15, 2019.
    40 changes: 40 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,40 @@

    steps for setting SSH key on Github and localhost
    ---------------------------------------------------------
    1. generate SSH key on localhost ~/.ssh/ssh_key_folder

    2. if there is more than 1 Github account ,
    then need to setting "config" file in ~/.ssh folder

    3. activate ssh-agent for add private SSH key

    4. using ssh-add command to
    (a.) delete cached key
    (b.) add new private key
    (c.) list and check added key

    5. go Github website and login ,
    then adding SSH key

    6. cat ~/.ssh/ssh_key_folder/id_rsa.pub
    copy public SSH key , then paste on Github

    7. test it ,
    clone and push any repo for ensure everything works fine.


    ref:
    --------------------------------------------------------
    # ssh-agent
    https://help.github.com/en/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent
    https://blog.gtwang.org/linux/using-ssh-agent-forwarding-to-avoid-being-asked-passphrase/
    https://www.ssh.com/ssh/agent

    # ssh-add command
    http://man.linuxde.net/ssh-add

    # multiple github account ssh key setting
    https://gist.github.com/jexchan/2351996

    # existing ssh key
    https://help.github.com/en/enterprise/2.13/user/articles/checking-for-existing-ssh-keys