Skip to content

Instantly share code, notes, and snippets.

@teebow1e
Last active June 30, 2025 06:24
Show Gist options
  • Select an option

  • Save teebow1e/7af5d089f6b3f492943157869029dc41 to your computer and use it in GitHub Desktop.

Select an option

Save teebow1e/7af5d089f6b3f492943157869029dc41 to your computer and use it in GitHub Desktop.

Revisions

  1. teebow1e revised this gist Aug 12, 2024. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion ssh_setup.md
    Original file line number Diff line number Diff line change
    @@ -9,7 +9,7 @@ ssh-keygen -t rsa -b 4096 -C "your_email@example.com"
    ssh-keygen -t ed25519 -C "your_email@example.com"
    ```

    2. Copy the key to clipboard
    2. Copy the public key (.pub) to clipboard
    3. Paste into [GitHub SSH and GPG keys page](https://github.com/settings/keys)
    4. Verify the connectivity
    ```shell
  2. teebow1e renamed this gist Jul 24, 2024. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  3. teebow1e revised this gist Feb 16, 2024. 1 changed file with 17 additions and 2 deletions.
    19 changes: 17 additions & 2 deletions gistfile1.md
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    ## Step-by-step guide
    ## Get SSH key working

    1. Create a SSH key
    ```shell
    @@ -27,4 +27,19 @@ ssh-add &>/dev/null || eval `ssh-agent` &>/dev/null
    }
    ```

    > Sidenote: If you are using SSH key and works with private stuff, you need to interact with them using SSH protocol, not HTTP.
    > Sidenote: If you are using SSH key and works with private stuff, you need to interact with them using SSH protocol, not HTTP.
    ## Signing your Commits
    1. Upload your previously-created keys (or just create a new key) to [GitHub SSH and GPG keys page](https://github.com/settings/keys). Make sure to specify it as `Signing Key`.
    1.1. Optional
    - Run this command to always verify your commit in a specific local repo: `git config commit.gpgsign true`
    - Run this command to always verify your commit: `git config --global commit.gpgsign true`
    2. Let Git know about your signing key
    ```shell
    git config --global gpg.format ssh
    git config --global user.signingkey /PATH/TO/.SSH/KEY.PUB
    ```
    3. Verify by signing a commit
    ```shell
    git commit -S -m "<example>"
    ```
  4. teebow1e revised this gist Feb 16, 2024. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion gistfile1.md
    Original file line number Diff line number Diff line change
    @@ -25,4 +25,6 @@ ssh-add &>/dev/null || eval `ssh-agent` &>/dev/null
    [ $? -eq 0 ] && {
    ssh-add ~/.ssh/<your_key_name> &>/dev/null
    }
    ```
    ```

    > Sidenote: If you are using SSH key and works with private stuff, you need to interact with them using SSH protocol, not HTTP.
  5. teebow1e renamed this gist Feb 16, 2024. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  6. teebow1e created this gist Feb 16, 2024.
    28 changes: 28 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,28 @@
    ## Step-by-step guide

    1. Create a SSH key
    ```shell
    ssh-keygen -t rsa -C "your_email@example.com"
    # this is also okay
    ssh-keygen -t rsa -b 4096 -C "your_email@example.com"
    # maybe this (up to your preference)
    ssh-keygen -t ed25519 -C "your_email@example.com"
    ```

    2. Copy the key to clipboard
    3. Paste into [GitHub SSH and GPG keys page](https://github.com/settings/keys)
    4. Verify the connectivity
    ```shell
    ssh -T -v git@github.com
    # or this if you use custom key name (instead of the normal id_rsa)
    # more information: https://serverfault.com/questions/1119891/ssh-not-working-when-custom-key-name-is-used
    ssh -T -v -i <custom_file_name> git@github.com
    ```

    5. By default, for some reason, new session of Bash/ZSH may not load your SSH key, therefore, you need to initialize a SSH agent and load your key each time you start a new session.
    ```shell
    ssh-add &>/dev/null || eval `ssh-agent` &>/dev/null
    [ $? -eq 0 ] && {
    ssh-add ~/.ssh/<your_key_name> &>/dev/null
    }
    ```