Can I change Git Bash default path in Eclipse Terminal? - eclipse

I already changed GitBash default path in local.
But I failed to change GitBash default path in Eclipse Terminal.
Eclipse Terminal / Git Bash in local
Is there any way to change GitBash default path in Eclipse?
I would be grateful if you let me know if there is a proper solution.

Related

Copy and Paste mouse shortcuts in Git Bash terminal in Eclipse

The text cannot be COPIED by double-clicking and PASTED on right-clicking when working on Git bash in Eclipse, similar to the usage in Git Bash Windows application, which saves much time.
Is there any solution or best terminal alternative integrated in Eclipse?
That does not seem to be supported by the Terminal component, part of CDT since Eclipse 2020-03, with code source now in org.eclipse.cdt.git/tree/terminal.
No issue has been mentioned in this bugzilla list, which means you would need to create one to mention this use case.

Start the wsl terminal to the same path as of VSCode project folder

I work on various projects located in different directories. So I can't be specific to CWD settings in
VSCode using
"terminal.integrated.cwd": ""
Whenever I open a folder in VSCode with remote-wsl I want my terminal to be also open at the same location as of folder. I have trouble figuring it how to achieve this actually or have I missed something in VSCode settings.

Use PowerShell as the WebStorm terminal and open in current project folder

I am using WebStorm 2016.1 and have configured PowerShell as the terminal by using powershell.exe as the shell path in WebStorm's terminal settings:
When I open the terminal it does not open in the current project folder, but in my home folder.
How do I make it open in the current project folder?
Works fine for me. Do you have any PowerShell $PROFILE files? if yes, check if 'Set-Location' is specified there. See also https://superuser.com/questions/507387/autorun-for-powershell

Use Egit to launch pre-commit hook

I am working in Eclipse Mars (4.5.2) with EGit (4.1.1) on Windows8.
I try to launch a pre-commit hook from within eclipse using GitForWindows.
I started the pre-commit file with: #!/bin/sh
and gave the PATH Variable GITFORWINDOWS with the path to the bin folder in which the sh.exe of my GitForWindows installation is stored (C:\Program Files\Git\bin).
If I do git commit in the GitBash, pre-commit is executed correctly, thus an error is thrown if a certain string is detected in the staged files. If I commit in Eclipse nothing happens. What am I doing wrong?
EDIT
I tried it with Cygwin as well. While it is working from the cygwin terminal (as well as from the GitInWindows terminal) it is not working from within eclipse.
I set the PATH to C:\cygwin64\bin where the sh.exe is.
Can line returns be a problem? I have LF so far.
To run hooks from with in Eclipse (Egit) you need to do the following:
Hooks are implemented as scripts which need to be executed by "/bin/sh".
But on a plain windows machine you don't have a sh.exe.
So, you need to install cygwin and add <cygwin_root>/bin to your PATH.
Make sure that during cygwin installation you also install git (because the hook scripts want to execute git commands).
Setting the PATH variable for Cygwin worked in the end. I had to restart the computer though.
It still is not working for GitForWindows. This might be due to the fact that JGit has a FS_Win32_Cygwin class which extracts the path to the sh.exe from the 'PATH' variable. Such a class might not exist for GitForWindows (yet). More information here.
The version (4.1.1) of my EGit doesn't seem to play a role.

Eclipse Git Configuration System Settings is disabled

I'm working with Eclipse Mars, on Windows 7 64 bits and I recently discovered that when I clone a repository using eclipse built-in git clone feature, CRLF are not added to the files, and they are cloned with only LF at the end.
I checked Eclipse config for Git (Team > Git > Configuration) and I found that System Settings is empty and all buttons disabled and it says "Unknown" in the Location field.
I have Git for Windows 2.5.0 64 bits installed. Apparently now the system gitconfig file should be under C:\Program Files\Git\mingw64\etc but by default there is no file there.
I discovered that if I manually populate it from cmd (git config --system core.autocrlf true) it will be created, but still can't select it from Eclipse.
You need to tell EGit where the default system configuration is for it to be able to pick up the values. There's a Browse button which should allow you to change it according to the help pages:
https://wiki.eclipse.org/EGit/User_Guide#Pointing_out_the_System_wide_configuration
You can also set this property in the User Settings which Eclipse will respect. Global is 'for all users of this machine' and User Settings is typically stored in your home directory, i.e. 'for just this user'.
You'd have to find where the file that's being created by git config --global on your setup is. It's likely that git isn't on the path, and that's why Eclipse can't auto-guess where it should be.
By the way, unless you really, really need to have CRLF on the files you should prefer to keep them as how they are stored remotely - it will be faster for EGit and Git to perform deltas if it doesn't have to do line-ending conversion on most operations.
I had a similar problem so let me add this for clarification: in Eclipse Preferences > Team > Git > Configuration the System Settings Tab was empty and "Location:" said "Unknown". The EGit User Guide (https://wiki.eclipse.org/EGit/User_Guide#Pointing_out_the_System_wide_configuration) tells that "If you selected one of the options to use Git from the Command Line Prompt when you installed Git for Windows, then the location of the system wide settings is filled in with a path and everything is fine. If not, use the Browse button to locate where Git is installed, e.g. C:\Program Files(x86)\Git." Indeed I did not select the option to use "Git from the Command line ..." when I installed Git. But instead of a "Browse" button my Eclipse 2020-09 has an "Open" button and that one was GREYED OUT, so I was unable to tell EGit in the above mentioned "System Settings" Tab where the local Git installation could be found. Furthermore I did not know which path precisely had to be added to the systems PATH variable.
I then reinstalled Git with the option to use "Git from the Command line ..." and found out that "C:\Program Files\Git\cmd" was added to the System PATH. After a restart of Eclipse the "System Settings" Tab had the "Location" configured as: "C:\Program Files\Git\etc\gitconfig" and all the missing keys and corresponding values were set.