0

I was looking for an option to show the git branch in Windows 11 terminal when navigating to a local git directory. And if possible auto-complete support for git commands.

So far I was using GitBash for this, is there a way we can do this in the default windows terminal in the new windows 11 OS.

Dipak
  • 6,532
  • 8
  • 63
  • 87

3 Answers3

1
  1. Install Git bash (download)
  2. Open windows terminal enter image description here
  3. Click on the down-arrow in the title bar of the terminal app and click on settings enter image description here
  4. Open settings with your favorite text editor (vim :P )
  5. In the settings.json file, add the following in the profiles lists section
{
 "commandline" : "C:/Program Files/Git/bin/bash.exe --login", 
 "guid" : "{14ad203f-52cc-4110-90d6-d96e0f41b64d}", 
 "name" : "Git Bash", 
 "hidden" : false,
 "startingDirectory": "C:\\path"
},

enter image description here 6. In the settings.json update defaultProfile value with {14ad203f-52cc-4110-90d6-d96e0f41b64d} , as in the profiles section.

  1. Save and close text editor and windows terminal instance
  2. Open terminal again, Woohoo!!!!
Dipak
  • 6,532
  • 8
  • 63
  • 87
  • Oh, if your question was simply how to run Git Bash under Windows Terminal, it's even easier than that. Just install the latest Git Bash and restart Windows Terminal. The latest version will install a JSON fragment that will get loaded into Windows Terminal automatically. – NotTheDr01ds Oct 19 '21 at 12:08
1

I was experiencing the same issue. Clean install of windows 11. Installed Git using chocolatey. Windows terminal had git-bash as an option when I first opened it, but it would open in a new window.

For me after reading this a a few other post, I just fixed it by updating my "settings.json" file. It was originally pointing to git-bash.exe

"commandline" : "C:/Program Files/Git/Git-bash.exe",

To fix it, I changed it to point to bash.exe instead

"commandline" : "C:/Program Files/Git/bin/bash.exe",
Wurm
  • 11
  • 1
0

Your self-answer shows that I misunderstood your question. Apparently what you really want to know is how to run Git Bash in Windows Terminal.

That's even easier than your answer -- Just install the newest release of Git Bash. It should automatically create a profile in Windows Terminal using a recent WT feature called a JSON fragment extension.

After reinstalling Git Bash using the latest version, just restart Windows Terminal and you should have a new profile for Git Bash.

Of course, you should delete (or rename) your existing manually created profile first to avoid conflicts.

NotTheDr01ds
  • 15,620
  • 5
  • 44
  • 70