githubzshdotfilesgithub-codespaces

dotfiles (zsh setup) in GitHub Codespaces: no effect


I'm trying to get GitHub codespaces to recognize my dotfiles, to auto-setup zsh shell.

When I enter a codespace, either on the web or from VSCode the dotfiles have no effect. No error message either.

Here's what I've done

  1. Created a public dotfiles repo on GitHub, containing .zshrc and setup.sh (contents below). Added the files directly via the "add file" on github.com, then copy/paste.

  2. Enabled auto-run dotfiles in Codespaces via github.com > settings > codespaces > use dotfiles = true (checkbox)

  3. VSCode > settings > linux default shell > zsh

setup.sh

#!/bin/bash

git clone git://github.com/zsh-users/zsh-autosuggestions $ZSH_CUSTOM/plugins/zsh-autosuggestions
git clone https://github.com/zsh-users/zsh-history-substring-search ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-history-substring-search
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting

cat .zshrc > $HOME/.zshrc

.zshrc

export ZSH="${HOME}/.oh-my-zsh"

ZSH_THEME="robbyrussell"

DISABLE_UNTRACKED_FILES_DIRTY="true"

plugins=(zsh-autosuggestions history-substring-search zsh-syntax-highlighting)

source $ZSH/oh-my-zsh.sh

PROMPT="*** zsh *** %~   "


Solution

  • I have noticed that dotfiles don't get applied to the zsh shell that first comes up right after re-building the codespace. I'm still looking into this to understand it better. Starting a new zsh shell fixes the issue for me -- the dotfiles get applied. Does that fix the issue for you?

    Also, I recommend doing a symlink instead of cat, in the setup.sh. See my blog post for more details: https://bea.stollnitz.com/blog/codespaces-terminal/