Search code examples
visual-studio-codevscode-remote

How to open a remote repository in vscode with a windows shortcut


I can add a windows shortcut to open a specific folder in vscode. I just add the folder to the windows shortcut's properties target value as described here

I have remote repositories vscode extention installed and open repositories which uses virtual workspace which are just github repos. There is no local folder or local file to put in the target value of my windows shortcut's properties.

How am I able to edit a windows shortcut's properties target value to open a remote repository on github?


Solution

  • That following shortcut allows me to open a remote repository in vscode that makes use of virtual workspaces

    "C:\Users\myusername\AppData\Local\Programs\Microsoft VS Code\Code.exe" --folder-uri "vscode-vfs://github/githubusername/githubreponame
    

    The various parts are

    • The vscode executable location on my local PC
    • "--folder-uri" argument to pass the virtual workspace folder
    • Virtual workspace name prepended by vscode-vfs:// where githubusername is my github user and githubusername is the name of my repository.