Codespaces settings.json location

I am trying to replace settings.json file in a Codespace by my own version.

But, the problem is that I cannot find native settings.json file. It should be located under $HOME/.config/Code/User/settings.json. But, /$HOME/.config/ does not exist.

Instead, vscode shows that settings.json is located under /User/settings.json.
Screenshot:

But, this folder does not exist on disk.

What should I do?

Hi @sobolevn,

There are multiple different settings file you can use to achieve this, the file you want to change is kept in the browser storage so won’t be directly editable in the web case of the Codespaces. You can:

  • add the .vscode/settings.json file into the root of the workspace instead (workspace settings)
  • modify the /home/codespace/.vscode-remote/data/Machine/settings.json file instead (remote codespaces settings) - this file will be present on the codespace filesystem as you would expect.

Hope it helps :slight_smile:

1 Like

@sobolevn, you can also leverage VS Code Settings Sync (which is enabled in Github Codespaces) to sync your user settings across codespaces and between a codespace and VS Code on the desktop.

1 Like

Sorry, but I have checked the proposed solution and no files are present in /home directory.

So, /home/codespace/.vscode-remote/data/Machine/settings.json does not exist.

I have tried to create this folder manually with mkdir -p /home/codespace/.vscode-remote/data/Machine/ and then changing something inside the Remote settings. Still no settings.json file.

The Remote settings file is in /root/.vscode-remote/data/Machine/settings.json

To clarify, the settings file will be in ~/.vscode-remote/data/Machine/settings.json, and the exact value of ~ or $HOME will depend on the container image that is being used for the codespace. The default codespaces image runs as the codespace user with a home directory of /home/codespace, but a custom image might use root with a home directory of /root, or any other user and home directory path.