How to customize Git Bash Shell prompt settings

Customize Git Bash Shell config

By default, the Git Bash Shell displays computer name and username properties in the prompt window. Understandably, some users prefer to change these Git Bash Shell settings. Fortunately, it’s not that difficult to do.

customize git bash shell config

Edit the git-prompt.sh file to customize the Git Bash Shell prompt’s config settings.

Steps to customize Git Bash style

Follow these steps to customize the username, computer name, title and colors of the Git Bash Shell prompt:

  1. Locate the Git installation folder on your computer.
  2. Make a backup of the git-prompt.sh file in Git’s etc\profile.d subfolder.
  3. With administrator rights, edit the properties in the file named PS1.
  4. Save the git-prompt.sh file.
  5. Open a new Git Bash Shell prompt to see the customized properties display.

Edited git-prompt.sh settings example

Here is a snippet from the git-prompt.sh file that changes the Git Bash Shell’s hostname, username and title:

PS1='\[\033]0;New Git Bash Title:$PWD\007\]' # change Git Bash window title
PS1="$PS1"'\n'           # new line
PS1="$PS1"'\[\033[32m\]' # change Git Bash prompt color to green
PS1="$PS1"'New Git Bash Username & Hostname ' # Change Git Bash shere user@host<space> setting
PS1="$PS1"'\[\033[35m\]' # change Git Bash shell color to purple
PS1="$PS1"'Not Ming32 '  # change Git Bash shell MING64 display
PS1="$PS1"'\[\033[33m\]' # change Git Bash Prompt color to brownish yellow
PS1="$PS1"'\w' # Display Git Bash prompt'scurrent working directory

Updated Git Bash Shell configuration

When you save these changes, all new Git Bash Shell prompts that are opened will display the updated settings.

git bash shell hostname setting

After customizing the Git Bash Shell’s configuration, a new title, username and hostname display in the prompt.