Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hide username and computer name from Git Bash for Windows 10

enter image description here

Is there any way to remove the username and computer name from Git Bash for Window 10?

I already checked this : https://github.com/Maximus5/ConEmu/issues/199

But didn't understand how to do that.

like image 712
Akash Agrawal Avatar asked Nov 27 '22 20:11

Akash Agrawal


2 Answers

Follow the steps below:

  1. Go to C:\Program Files\Git\etc\profile.d\ folder
  2. Find and open the git-prompt.sh file in your favorite text editor
  3. Go to line number 15
  4. Replace the whole line with PS1="$PS1"''
  5. That's it. Start/Restart Git Bash and you should see the username and computer name is gone.

NOTE: You can also hide the annoying MINGW64 text by commenting out the line number 16 and 17 of the same file. To comment out those lines just add a # to the beginning of the line. That's it. Now start/restart Git Bash and it should go away.

like image 181
Saabbir Avatar answered Mar 02 '23 01:03

Saabbir


Better way!!

Follow the steps as mentioned by @Saabbir, with one big change:

# 👇 comment out the wrapping if-else block
if test -f ~/.config/git/git-prompt.sh
then
    . ~/.config/git/git-prompt.sh
else
  # 👇 leave the content uncommented
  ...
fi

Save the file, git-prompt.sh using Save As (in your editor) in this path C:\Users\{current_windows_user}\.config\git


Explanation: You can see on line number 8 that it checks for the same file on ~/.config/git. So it's better to update the config file rather than the actual settings file.

like image 25
Vijay Dev Avatar answered Mar 02 '23 00:03

Vijay Dev