How to enable PowerShell in Github Codespaces?

Are you the one stuck with the below issue?

Unable to find the PowerShell in the GitHub codespaces terminal.
PowerShell is not available after installing the extension in the GitHub codespaces.
Not comfortable with Bash.

See the below image, the PowerShell option is missing in the CodeSpaces terminal and you’re going to learn how to enable it now.

 

Fig 1. Github CodeSpaces — PowerShell missing

No worries. You can enable the PowerShell in the GitHub codespaces because many of us have done it already.

1. Go to your GitHub repository

 
Fig 2. Github repository — dev container

2. Open the “devcontainer.json”

Open the file «devcontainer.json».
If you haven’t configured the dev container already then configure the new one by selecting the «configure dev container» option under the CodeSpaces. Refer to the below image,

 

Fig 3. Github CodeSpaces — Add dev container

3. Launch your codespace

4. Add PowerShell to the dev container

Go to the devcontainer folder -> devcontainer.json and add the below lines to enable the PowerShell inside your container.

{
«image»: «mcr.microsoft.com/devcontainers/universal:2»,
«features»: {
«ghcr.io/devcontainers/features/powershell:1»: {}
}
}

Rebuild the container,

 

Fig 4. Github CodeSpaces — Add PowerShell and rebuild the container

Here you go, the PowerShell is enabled in your GitHub CodeSpaces terminal.

 

Fig 5. Github CodeSpaces — PowerShell enabled

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *