Install Scoop: A Command-Line Installer for Windows
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
iex "& {$(irm get.scoop.sh)} -ScoopDir ${Env:USERPROFILE}/Scoop"
scoop install git
scoop bucket add extras
Scoop is a command-line installer for Windows that makes it easy to install and manage software.
To install PowerShell and other utilities:
winget upgrade --all --silent --include-unknown
winget install Microsoft.PowerShell
winget install Microsoft.PowerToys
Font settings
Recommended font: Maple Mono
scoop bucket add nerd-fonts
scoop install Maple-Mono Maple-Mono-NF
Customize Powershell
Install Starship to customize your PowerShell prompt.
scoop install starship
Invoke-Expression (& starship init powershell) # Add the following to the end of your PowerShell configuration
Update your PowerShell profile:
winget install Microsoft.VisualStudioCode
code $PROFILE
Add your profile content and save the file.
To update Windows Terminal settings:
- Set it as the default profile
- Disable the logo by adding
-NoLogo
after the command (/pwsh.exe -NoLogo
) - Set the font face to
Maple Mono NF
underSettings/Defaults/Font face
Install Visual Studio Code and Docker Desktop
To install Docker Desktop and Visual Studio Code:
winget install Docker.DockerDesktop
winget install Microsoft.VisualStudioCode
Note
If using Docker Desktop is not feasible, you can set up Docker with WSL instead:
# Ensure WSL is installed
sudo apt update --yes && sudo apt upgrade --yes
mkdir -p ~/Downloads
curl -fsSL https://get.docker.com -o ~/Downloads/get-docker.sh
sudo sh ~/Downloads/get-docker.sh
sudo usermod -aG docker $USER
sudo apt autoremove --yes
rm ~/Downloads/get-docker.sh
# If there are issues with Docker setup, consider deleting the ~/.docker folder both on the host and within WSL
Open Windows Terminal with Administrator Permissions
Set up the new user. The following commands are run in PowerShell, not in WSL:
# Set up Ubuntu within WSL or choose a specific release, such as Ubuntu-24.04
wsl --install --distribution Ubuntu-24.04
Restart-Computer
# After reboot, rerun the installation command if needed
wsl --install --distribution Ubuntu-24.04
wsl --update
wsl --user root apt update --yes
wsl --user root apt upgrade --yes
# Check system info
wsl lsb_release --all
# Set the default distribution
wsl --list
wsl --set-default Ubuntu-24.04
# Prepare WSL image for upgrade
sudo apt install update-manager-core
# Upgrade WSL image; use the "-d, --devel-release" flag for development versions
sudo do-release-upgrade
sudo apt update --yes && sudo apt upgrade --yes
sudo apt install --yes zsh
sudo apt autoremove --yes
It's recommended to export your WSL image to an external disk for backup and space-saving purposes:
wsl --shutdown
# Export WSL image to an external disk
mkdir E:/WSL
wsl --export Ubuntu-24.04 "E:/WSL/Ubuntu-24.04.tar"
wsl --unregister Ubuntu-24.04
wsl --import Ubuntu-24.04 "E:/WSL/Ubuntu-24.04" "E:/WSL/Ubuntu-24.04.tar"
wsl --set-default Ubuntu-24.04
Tip
Add WSL configuration on the host.
Check wslconfig. Restart WSL:
wsl --shutdown
Install extensions for remote development:
code --install-extension ms-vscode-remote.remote-wsl
Note
You don't need to set up Git on the host, but it's recommended to set the email and name globally.
Use Windows Terminal, VS Code, or WSL Bash.
Git config: Check out Delta and exiftool.
# On WSL Ubuntu
base_url=https://github.com/dandavison/delta/releases
delta_version=$(curl -s "https://api.github.com/repos/dandavison/delta/releases/latest" | grep -Po '"tag_name": "\K.*?(?=")')
filename="git-delta_${delta_version}_amd64.deb"
# Download and install Delta
curl -fsSL "${base_url}/download/${delta_version}/${filename}" -o "$HOME/Downloads/$filename"
sudo dpkg --install "$HOME/Downloads/git-delta_${delta_version}_amd64.deb"
sudo apt install --yes exiftool
rm "$HOME/Downloads/$filename"
Setup Zsh
Oh-My-Zsh helps in customizing your shell.
sudo apt install --yes zsh
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
curl -sS https://starship.rs/install.sh | sh
Configure Git for Multiple Repositories
Use local repositories in the following structure:
# Set up includeIf for GitHub repos
git config --global --add includeIf.gitdir:"$HOME/Code/GitHub/**/.git".path "$HOME/Code/GitHub/.gitconfig"
# Configure GitHub-specific fetch refspec
git config --file="$HOME/Code/GitHub/.gitconfig" --add remote.origin.fetch "+refs/pull/*/head:refs/remotes/origin/pull_requests/*"
# Optionally remove conflicting settings from specific repositories
# Navigate to the repository and run:
git config --file=.git/config --unset remote.origin.fetch
# Verify your configurations to ensure that the correct settings are applied
git config --list --show-origin
~/Code
├── GitHub
│ ├── .gitconfig
│ ├── john_doe
│ │ ├── acme
│ │ │ └── .git
│ │ ├── ...
│ ... ...
├── GitLab
│ ├── .gitconfig
│ ├── jane_doe
│ │ ├── foo
│ │ │ └── .git
│ │ ├── ...
... ... ...
Configure refspecs for different repositories (GitLab, GitHub, Bitbucket).
# Set up includeIf for GitLab repos
git config --global --add includeIf.gitdir:"$HOME/Code/GitLab/**/.git".path "$HOME/Code/GitLab/.gitconfig"
# Set up includeIf for Bitbucket repos
git config --global --add includeIf.gitdir:"$HOME/Code/Bitbucket/**/.git".path "$HOME/Code/Bitbucket/.gitconfig"
# Configure GitLab-specific fetch refspec
git config --file="$HOME/Code/GitLab/.gitconfig" --add remote.origin.fetch "+refs/merge-requests/*/head:refs/remotes/origin/merge_requests/*"
# Configure Bitbucket-specific fetch refspec
git config --file="$HOME/Code/BitBucket/.gitconfig" --add remote.origin.fetch "+refs/pull-requests/*/from:refs/remotes/origin/pull_requests/*"
# Optionally remove conflicting settings from specific repositories
# Navigate to the repository and run:
git config --file=.git/config --unset remote.origin.fetch
# Verify your configurations to ensure that the correct settings are applied
git config --list --show-origin
Note
If you have issues with signing commits with a GPG key, check GPG for Win, sharing GPG keys.
GPG for Win, sharing GPG keys and about commit signature verification
To install GPG and configure it:
scoop install sudo
sudo scoop install gpg4win
logoff
After logging back into WSL, you should be all set.