Git Bash terminal in Eclipse on MS Windows - eclipse

I have two different laptops running MS Windows and noticed on one laptop there was a Git Bash option for a new terminal window in the Terminal view in Eclipse, while it was not available on the other laptop.
After a little trial and error, I was able to determine the Git Bash option is only available if the git cli client from https://git-scm.com is installed.
I like to be able to run git from the command line in Eclipse without having to switch windows. Hope this helps someone trying to do the same thing.

You can use the Open A Terminal icon to open up Git Bash if Git Bash is already installed on your Windows machine.
Update:
Add Gitbash terminal to Eclipse:

Install this plugin on Eclipse Marketplace:
TM Terminal
https://marketplace.eclipse.org/content/tm-terminal
After that, go to Window -> Preferences -> Terminal -> Local Terminal and add a entry with full path where Git Bash executable (bash.exe) was installed.
Then you can open Git Bash pressing CTRL+ALT+SHIFT+T.

Related

I have to open visual studio code as administrator or I won't be able to open a terminal

I have the latest version of VSC installed on a Windows 10 machine. If I run VSC regularly, so not as an admin, then if I try to open a terminal I get a 740 error. If I start VSC with Administrator privileges everything works fine.
What could be causing this? I would prefer if I didn't have to run VSC with Admin privileges.
P.S.
I'm using VSC its integrated Terminal.
If I switch to Command Prompt as external Terminal, the problem is gone. But I would prefer to continue to use the integrated Terminal.
There are some other Slack topics that point to ensure not running VSC in compatibility mode, which is indeed disabled on my end.
I found out the cause. Git Bash was configured as the Integrated Terminal of VSC. Its run file C:\Program Files\Git\bin\bash.exe was configured in Windows to "Run as Administrator". As a result, I also had to start VSC "as administrator" to open a Terminal. After unchecking the box "Run as Administrator" for Git Bash, I no longer need to run VSC as administrator to be able to open the Terminal.

VSCode opens different workspace from commandline and gnome launch icon on Fedora

I have VSCode 1.65.2 running on Fedora 35, and I always launch it from Gnome (by clicking on the VSCode icon). I recently wanted to set up VSCode as the editor for git by running git config --global core.editor "code -r --wait", so that if I would run e.g. git commit in VSCode's integrated terminal, it would open the commit message in the already open VSCode window. But the result is that it always opened a new window, even though I passed -r to it.
I found out that VSCode launched from the command line used settings from the ~/Code folder, while if I launched it from Gnome (by clicking on the icon), it used ~/.config/Code for my settings.
So I created a symlink from ~/Code to ~/.config/Code, and I hoped that it would solve this issue.
It did not.
It still always behaves differently if I launch it from Gnome and if I launch it from the command line.
How can I solve this?

Looking for help on setting up wsl in vscode terminal

If I'm in my terminal and open a file with the code command, vscode will launch and the terminal inside code will show my full zsh setup that I have configured in hyper terminal. But if I open up code through windows, and select wsl as my default shell, it's pretty much useless. Anything I try, like sudo, git, apt, etc will return a command not found message.
So if I want to commit any changes in the terminal inside code then I have to use the git bash shell. Is it possible to get my zsh working without first launching from my terminal emulator so I'm using wsl instead of git bash?
running wslconfig.exe /list in powershell showed me that WSL was set to docker as the default shell, so then running wslconfig.exe /setdefault "Ubuntu" in powershell fixed my problem.

How to Add Git Bash to VsCode

It is not showing Git Bash Option in while selecting terminal in VsCode
Make sure you have already installed Git for Windows
In VS Code, go to Command Palette (⇧⌘P) with Terminal: Select Default Profile or Terminal: Select Default Shell in older versions, then select available shell in this case, Git Bash, in the dropdown list.
Click on + sign next to terminal list as shown below:
At this point, the Git Bash should be successfully added.
PS. The list might disappear if the VS Code is closed. Only the default shell will show up. You have to do the steps above again.

Vscode (code.exe) command line arguments to immediately open a remote workspace folder over SSH

If I want to open a workspace on a regular local folder under C:\ I can just execute the command:
code.exe C:\the-local-workspace-folder
Is there any equivalent command for opening remote SSH workspaces?
I want to be able to use my keyboard launcher to open them, rather than needing to open them the fiddly way in the internal menus inside vscode.
So I need a regular system command to be able to do this.
I've looked through the command line arguments here: https://code.visualstudio.com/docs/editor/command-line - but can't find anything about remote workspaces at all.
I've also tried commands like:
code.exe username#hostname.example.com:/workspace-folder
code.exe username#hostname.example.com/workspace-folder
...but they don't work for this.
This looks like a recent fix, according to the issue tracking here. I've tested with my own settings, and this works:
"C:\Users\myusername\AppData\Local\Programs\Microsoft VS Code\Code.exe" \
--remote ssh-remote+myubuntumachine /home/myusername/myprojectdirectory
The myubuntumachine should be the name given in the Host myubuntumachine in the SSH config file on CTRL+SHIFT+P/Remote SSH: Open Configuration File...
(Actually, on my machine I don't have the machine name, but some sort of hash value, although either works.)
VSCode 1.63 (Nov. 2021) adds the option -n (issue 137529), to make sure a new window is opened for remote CLI:
The following options got added to the remote CLI:
-n to open a new window of the same remote as the current window
-n --remote=wsl+ubuntu to open a new window of a different remote
-n --remote=local to open a new local window
To get started, you need to:
Install an OpenSSH compatible SSH client if one is not already present.
Install Visual Studio Code or Visual Studio Code Insiders.
Install the Remote Development extension pack.
Read more : https://code.visualstudio.com/docs/remote/ssh
Installations extension :
code.exe --install-extension ms-vscode-remote.remote-ssh
Follow the step-by-step tutorial or if you have a simple SSH host setup, connect to it as follows:
Press F1 and run the Remote-SSH: Open SSH Host... command. Enter
your user and host/IP in the following format in the input box that
appears and press enter: user#host-or-ip or
user#domain#host-or-ip If prompted, enter your password (but we suggest setting up key based authentication). After you are connected,
use File > Open Folder to open a folder on the host.
You can press F1 to bring up the Command Palette and type in Remote-SSH for a full list of available commands.
command list
You can change the location by launching VS Code with the --extensions-dir command-line option.
Where are extensions installed?#
Extensions are installed in a per user extensions folder. Depending on your platform, the location is in the following folder:
Windows %USERPROFILE%.vscode\extensions
Linux ~/.vscode/extensions
macOS ~/.vscode/extensions
To run remote ssh and open the folder in command-line :
code.exe --remote ssh-remote+root#server.com <your-directory>