Skip to content

Instantly share code, notes, and snippets.

@Lancear
Last active August 18, 2025 23:59
Show Gist options
  • Save Lancear/4b884d55d62bbfb3e42b16058bb48edd to your computer and use it in GitHub Desktop.
Save Lancear/4b884d55d62bbfb3e42b16058bb48edd to your computer and use it in GitHub Desktop.

Revisions

  1. Lancear revised this gist Apr 2, 2025. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions Git_SSH_setup_for_VS_Code.md
    Original file line number Diff line number Diff line change
    @@ -4,10 +4,10 @@ and times out with a permissions denied message. Adding the key to the SSH agent
    Of course it can be started in the `~/.profile` or `~/.bashrc`, but that is not helpful for the VS Code issue.

    To fix this we can tell git to use the OpenSSH service of Windows and add the key there, that SSH agent can be started automatically
    under services and will then also work with VS Code. I found this fix somewhere on the internet after some searching but lost the post
    about it again, thus decided to write it down myself to not struggle with it again.
    under services and will then also work with VS Code. I found this fix somewhere on the internet after some searching but unfortunately
    lost the post about it, thus decided to write it down myself to avoid struggling with it again in the future.

    > *Note: This short guide only assists in setup for the key to work nicely with VS Code on Windows.*
    > *Note: This short guide only assists in setting up the key to work nicely with VS Code on Windows.*
    > *For a guide on how to setup a SSH Key in general see the [Github Docs](https://docs.github.com/en/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent) or [Gitlab Docs](https://docs.gitlab.com/ee/ssh/), especially the generate and add to Github/Gitlab parts.*
    ## How to do it
  2. Lancear revised this gist Jun 4, 2024. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion Git_SSH_setup_for_VS_Code.md
    Original file line number Diff line number Diff line change
    @@ -7,7 +7,7 @@ To fix this we can tell git to use the OpenSSH service of Windows and add the ke
    under services and will then also work with VS Code. I found this fix somewhere on the internet after some searching but lost the post
    about it again, thus decided to write it down myself to not struggle with it again.

    > *Note: This short guide only assists in setup up the key to work nicely with VS Code on Windows.*
    > *Note: This short guide only assists in setup for the key to work nicely with VS Code on Windows.*
    > *For a guide on how to setup a SSH Key in general see the [Github Docs](https://docs.github.com/en/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent) or [Gitlab Docs](https://docs.gitlab.com/ee/ssh/), especially the generate and add to Github/Gitlab parts.*
    ## How to do it
  3. Lancear revised this gist Jul 4, 2022. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion Git_SSH_setup_for_VS_Code.md
    Original file line number Diff line number Diff line change
    @@ -16,7 +16,7 @@ about it again, thus decided to write it down myself to not struggle with it aga

    2. Set the `sshCommand` for git to use Windows' OpenSSH
    ```shell
    git config sshCommand C:/Windows/System32/OpenSSH/ssh.exe
    git config --global core.sshCommand C:/Windows/System32/OpenSSH/ssh.exe
    ```

    3. Inside a normal terminal, not git bash, add the key to the SSH Agent:
  4. Lancear revised this gist Dec 30, 2021. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions Git_SSH_setup_for_VS_Code.md
    Original file line number Diff line number Diff line change
    @@ -10,6 +10,7 @@ about it again, thus decided to write it down myself to not struggle with it aga
    > *Note: This short guide only assists in setup up the key to work nicely with VS Code on Windows.*
    > *For a guide on how to setup a SSH Key in general see the [Github Docs](https://docs.github.com/en/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent) or [Gitlab Docs](https://docs.gitlab.com/ee/ssh/), especially the generate and add to Github/Gitlab parts.*
    ## How to do it
    1. Go to the Windows services, search for `OpenSSH Authentication Agent`, start it and set it to automatically start in the future
    ![image](https://user-images.githubusercontent.com/52662014/147735822-4a624327-55d1-44bd-bbcf-3c9f9c69b67e.png)

  5. Lancear revised this gist Dec 30, 2021. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion Git_SSH_setup_for_VS_Code.md
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    # Setup for password protected Git SSH keys for Windows and VS Code
    # Setup for password protected Git SSH keys for VS Code on Windows
    When working with password protected ssh keys for git in VS Code on Windows, VS Code by default does not ask for the password
    and times out with a permissions denied message. Adding the key to the SSH agent also does not work, since it needs to be started manually.
    Of course it can be started in the `~/.profile` or `~/.bashrc`, but that is not helpful for the VS Code issue.
  6. Lancear renamed this gist Dec 30, 2021. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  7. Lancear created this gist Dec 30, 2021.
    26 changes: 26 additions & 0 deletions readme.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,26 @@
    # Setup for password protected Git SSH keys for Windows and VS Code
    When working with password protected ssh keys for git in VS Code on Windows, VS Code by default does not ask for the password
    and times out with a permissions denied message. Adding the key to the SSH agent also does not work, since it needs to be started manually.
    Of course it can be started in the `~/.profile` or `~/.bashrc`, but that is not helpful for the VS Code issue.

    To fix this we can tell git to use the OpenSSH service of Windows and add the key there, that SSH agent can be started automatically
    under services and will then also work with VS Code. I found this fix somewhere on the internet after some searching but lost the post
    about it again, thus decided to write it down myself to not struggle with it again.

    > *Note: This short guide only assists in setup up the key to work nicely with VS Code on Windows.*
    > *For a guide on how to setup a SSH Key in general see the [Github Docs](https://docs.github.com/en/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent) or [Gitlab Docs](https://docs.gitlab.com/ee/ssh/), especially the generate and add to Github/Gitlab parts.*
    1. Go to the Windows services, search for `OpenSSH Authentication Agent`, start it and set it to automatically start in the future
    ![image](https://user-images.githubusercontent.com/52662014/147735822-4a624327-55d1-44bd-bbcf-3c9f9c69b67e.png)

    2. Set the `sshCommand` for git to use Windows' OpenSSH
    ```shell
    git config sshCommand C:/Windows/System32/OpenSSH/ssh.exe
    ```

    3. Inside a normal terminal, not git bash, add the key to the SSH Agent:
    ```
    ssh-add <PATH_TO_YOUR_KEY>
    ```

    4. It will ask for your password, enter it, and then you are all set! :raised_hands: