DEV Community

Cover image for Colorful Git Prompt for Azure Cloud Shell and Visual Studio Code
Michael Crump for Microsoft Azure

Posted on

Colorful Git Prompt for Azure Cloud Shell and Visual Studio Code

In this tutorial, we aim to bring life to our boring old Azure Cloud Shell by adding a colorful Git prompt. Kinda like this one!

Alt Text

I have another post in which we style PowerShell and WSL (Bash) that is located here:

For those new to Azure Cloud Shell? Azure Cloud Shell is a browser-based shell experience to manage and develop Azure resources.

Let's do this!

0.) Open Azure Cloud Shell and select Bash.

1.) Notice that Git is already installed, so you can type git from the Bash prompt.

2.) Notice also that GoLang is also installed, so you can type go from the Bash prompt.

Go is a tool for managing Go source code.


        go command [arguments]
Enter fullscreen mode Exit fullscreen mode

Kind of cool isn't it? So why am I asking you to type git and go and the reason for that is because we'll be using both of these to setup our colorful Git prompts.

3.) We need to add Powerline for a beautiful and useful low-latency prompt for your shell, written in go.

go get -u
Enter fullscreen mode Exit fullscreen mode

4.) Edit ~/.bashrc with VS Code or Nano (ex. code ~/.bashrc or nano ~/.bashrc) and add the following information (source

function _update_ps1() {
    PS1="$($GOPATH/bin/powerline-go -error $?)"
if [ "$TERM" != "linux" ] && [ -f "$GOPATH/bin/powerline-go" ]; then
Enter fullscreen mode Exit fullscreen mode

Alt Text

5.) Install a compatible Font for your browser.

6.) Open up your Browser's font settings For Chrome, and change the Fixed Width Font line to the font we used installed.

Alt Text

Restart the browser and head back over to Azure Cloud Shell and navigate inside of a repository and you should see the new colorful Git prompt!

Alt Text

BONUS: Visual Studio Code Integration

0.) Add the Azure Account Extension or search from VS Code to install it easily.

1.) Log in to Azure (it will open a new web browser)

2.) Click the Settings (Gear icon) at the bottom of Visual Studio Code and click Settings again and add the font to your Editor: Font Family

Menlo, Monaco, 'Courier New', monospace, Delugia Nerd Font
Enter fullscreen mode Exit fullscreen mode

Alt Text

3.) Open the command palette and type Azure: Open Bash in Cloud Shell. This will connect you to your Cloud Shell instance running in Azure and you should see your new colorful Git prompt.

Alt Text


Did you like this? I streamed this live on Twitch. Follow me for upcoming developer streams.

Stream Replay

Stay connected with me on various social platforms for daily software development news.

Top comments (0)