Skip to content

Instantly share code, notes, and snippets.

@jbutko
Last active March 17, 2022 09:21
Show Gist options
  • Select an option

  • Save jbutko/b20a12c62b506737db82ff96f6449bb2 to your computer and use it in GitHub Desktop.

Select an option

Save jbutko/b20a12c62b506737db82ff96f6449bb2 to your computer and use it in GitHub Desktop.

Revisions

  1. jbutko revised this gist Mar 17, 2022. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion github-action-keys.md
    Original file line number Diff line number Diff line change
    @@ -18,7 +18,7 @@ IdentityFile=~/.ssh/project_x_id_rsa
    ```

    **5. Clone the repo with custom host:**
    `git clone git@github.com-project-x:user/project-x .`
    `git clone git@github.com-project-x:user/project-x.git .`

    **6. All good.**

  2. jbutko revised this gist Mar 17, 2022. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion github-action-keys.md
    Original file line number Diff line number Diff line change
    @@ -18,7 +18,7 @@ IdentityFile=~/.ssh/project_x_id_rsa
    ```

    **5. Clone the repo with custom host:**
    `git clone git@github.com-project-x:user/project-x`
    `git clone git@github.com-project-x:user/project-x .`

    **6. All good.**

  3. jbutko revised this gist Mar 17, 2022. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion github-action-keys.md
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,7 @@
    **1. Generate ssh key**
    `ssh-keygen -f ~/.ssh/project_x_id_rsa -t rsa -b 4096 -C "{email}"`

    **2. Add public key to "deploy keys"**
    **2. Add public key to "deploy keys" in github**
    - Add public key to "deploy keys" section in your project's Setting menu: https://github.com/user/project-x/settings/keys

    **3. Verify connection:**
  4. jbutko revised this gist Mar 17, 2022. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion github-action-keys.md
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,5 @@
    **1. Generate ssh key**
    `ssh-keygen -f project_x_id_rsa -t rsa -b 4096 -C "{email}"`
    `ssh-keygen -f ~/.ssh/project_x_id_rsa -t rsa -b 4096 -C "{email}"`

    **2. Add public key to "deploy keys"**
    - Add public key to "deploy keys" section in your project's Setting menu: https://github.com/user/project-x/settings/keys
  5. jbutko revised this gist Mar 17, 2022. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion github-action-keys.md
    Original file line number Diff line number Diff line change
    @@ -2,7 +2,7 @@
    `ssh-keygen -f project_x_id_rsa -t rsa -b 4096 -C "{email}"`

    **2. Add public key to "deploy keys"**
    - Add public key to "deploy keys" section in your github project https://github.com/user/project-x/settings/keys
    - Add public key to "deploy keys" section in your project's Setting menu: https://github.com/user/project-x/settings/keys

    **3. Verify connection:**
    `sudo ssh -T git@github.com`
  6. jbutko revised this gist Mar 17, 2022. 1 changed file with 6 additions and 12 deletions.
    18 changes: 6 additions & 12 deletions github-action-keys.md
    Original file line number Diff line number Diff line change
    @@ -1,19 +1,13 @@
    **1. Generate ssh key**
    `ssh-keygen -t rsa -b 4096 -C "{email}"`
    `ssh-keygen -f project_x_id_rsa -t rsa -b 4096 -C "{email}"`

    **2. Rename keys**
    ```
    mv ~/.ssh/id_rsa ~/.ssh/project_x_id_rsa
    mv ~/.ssh/id_rsa.pub ~/.ssh/project_x_id_rsa.pub
    ```

    **3. Add public key to "deploy keys"**
    **2. Add public key to "deploy keys"**
    - Add public key to "deploy keys" section in your github project https://github.com/user/project-x/settings/keys

    **4. Verify connection:**
    **3. Verify connection:**
    `sudo ssh -T git@github.com`

    **5. Edit ssh config file:**
    **4. Edit ssh config file:**
    * Edit ssh config file if you use multiple repos on server:
    `sudo nano ~/.ssh/config` and add these lines:

    @@ -23,10 +17,10 @@ Hostname github.com
    IdentityFile=~/.ssh/project_x_id_rsa
    ```

    **6. Clone the repo with custom host:**
    **5. Clone the repo with custom host:**
    `git clone git@github.com-project-x:user/project-x`

    **7. All good.**
    **6. All good.**


    sources:
  7. jbutko revised this gist Mar 17, 2022. 1 changed file with 6 additions and 4 deletions.
    10 changes: 6 additions & 4 deletions github-action-keys.md
    Original file line number Diff line number Diff line change
    @@ -7,12 +7,14 @@ mv ~/.ssh/id_rsa ~/.ssh/project_x_id_rsa
    mv ~/.ssh/id_rsa.pub ~/.ssh/project_x_id_rsa.pub
    ```

    3. Add public key to "deploy keys" section in your github project https://github.com/user/project-x/settings/keys
    **3. Add public key to "deploy keys"**
    - Add public key to "deploy keys" section in your github project https://github.com/user/project-x/settings/keys

    **4. Verify connection:**
    5. `sudo ssh -T git@github.com`
    `sudo ssh -T git@github.com`

    5. Edit ssh config file if you use multiple repos on server:
    **5. Edit ssh config file:**
    * Edit ssh config file if you use multiple repos on server:
    `sudo nano ~/.ssh/config` and add these lines:

    ```
    @@ -24,7 +26,7 @@ IdentityFile=~/.ssh/project_x_id_rsa
    **6. Clone the repo with custom host:**
    `git clone git@github.com-project-x:user/project-x`

    7. All good.
    **7. All good.**


    sources:
  8. jbutko created this gist Mar 17, 2022.
    32 changes: 32 additions & 0 deletions github-action-keys.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,32 @@
    **1. Generate ssh key**
    `ssh-keygen -t rsa -b 4096 -C "{email}"`

    **2. Rename keys**
    ```
    mv ~/.ssh/id_rsa ~/.ssh/project_x_id_rsa
    mv ~/.ssh/id_rsa.pub ~/.ssh/project_x_id_rsa.pub
    ```

    3. Add public key to "deploy keys" section in your github project https://github.com/user/project-x/settings/keys

    **4. Verify connection:**
    5. `sudo ssh -T git@github.com`

    5. Edit ssh config file if you use multiple repos on server:
    `sudo nano ~/.ssh/config` and add these lines:

    ```
    Host github.com-project-x
    Hostname github.com
    IdentityFile=~/.ssh/project_x_id_rsa
    ```

    **6. Clone the repo with custom host:**
    `git clone git@github.com-project-x:user/project-x`

    7. All good.


    sources:
    * https://gist.github.com/zhujunsan/a0becf82ade50ed06115
    * https://docs.github.com/en/developers/overview/managing-deploy-keys#using-multiple-repositories-on-one-server