About personalizing Codespaces
When using any development environment, customizing the settings and tools to your preferences and workflows is an important step. Codespaces allows for two main ways of personalizing your codespaces.
- Settings Sync - You can use and share Visual Studio Code settings between Codespaces and other instances of Visual Studio Code.
- Dotfiles – You can use a public
dotfiles
repository to specify scripts, shell preferences, and other configurations.
Codespaces personalization applies to any codespace you create.
Project maintainers can also define a default configuration that applies to every codespace for a repository, created by anyone. For more information, see "Configuring Codespaces for your project."
Settings Sync
Settings Sync allows you to share configurations such as settings, keyboard shortcuts, snippets, extensions, and UI state across machines and instances of Visual Studio Code.
To enable Settings Sync, in the bottom-left corner of the Activity Bar, select and click Turn on Settings Sync…. From the dialog, select which settings you'd like to sync.
For more information, see the Settings Sync guide in the Visual Studio Code documentation.
Dotfiles
Dotfiles are files and folders on Unix-like systems starting with .
that control the configuration of applications and shells on your system. You can store and manage your dotfiles in a repository on GitHub. For advice and tutorials about what to include in your dotfiles
repository, see GitHub does dotfiles.
If your user account on GitHub owns a public repository named dotfiles
, GitHub can automatically use this repository to personalize your codespace environment, once enabled from your personal Codespaces settings. Private dotfiles
repositories are not currently supported.
Your dotfiles
repository might include your shell aliases and preferences, any tools you want to install, or any other codespace personalization you want to make.
When you create a new codespace, GitHub clones your dotfiles
repository to the codespace environment, and looks for one of the following files to set up the environment.
- install.sh
- install
- bootstrap.sh
- bootstrap
- script/bootstrap
- setup.sh
- setup
- script/setup
If none of these files are found, then any files or folders in dotfiles
starting with .
are symlinked to the codespace's ~
or $HOME
directory.
Any changes to your dotfiles
repository will apply only to each new codespace, and do not affect any existing codespace.
Note: Currently, Codespaces does not support personalizing the User settings for the Visual Studio Code editor with your dotfiles
repository. You can set default Workspace and Remote [Codespaces] settings for a specific project in the project's repository. For more information, see "Configuring Codespaces for your project."
Enabling your dotfiles repository for Codespaces
You can use your public dotfiles
repository to personalize your Codespaces environment. Once you set up that repository, you can add your scripts, preferences, and configurations to it. You then need to enable your dotfiles from your personal Codespaces settings page.
-
In the upper-right corner of any page, click your profile photo, then click Settings.
-
In the left sidebar, click Codespaces.
-
Under "Dotfiles", select "Automatically install dotfiles" so that Codespaces automatically installs your dotfiles into every new codespace you create.
Note: This option is only available if you've created a public
dotfiles
repository for your user account.
You can add further script, preferences, configuration files to your dotfiles repository or edit existing files whenever you want. Changes to settings will only be picked up by new codespaces.
Other available settings
You can also personalize Codespaces using additional Codespaces settings:
- To set your default region, see "Setting your default region for Codespaces."
- To set your editor, see "Setting your default editor for Codespaces."
- To add encrypted secrets, see "Managing encrypted secrets for Codespaces."
- To enable GPG verification, see "Managing GPG verification for Codespaces."
- To allow your codespaces to access other repositories, see "Managing access and security for Codespaces."