Eclipse does not find git on windows installation - eclipse

I'm using eclipse in windows for embedding programming. Naturally git is a big part of my work and I want to keep track of hashes in my code. I tried using this question, and many similar ones to have the git hash as a preprocessor micro. So added git log -1 --pretty=format:'#define GIT_HASH %h' > ../Inc/gitinfo.h to pre-build step.
The trouble is that eclipse does not find git even though it is in the path (git works in windows cmd), and egit is also installed on my eclipse (Neon 4.6.3).
Also tried to add the command in a batch file and run that file in the pre-build using cmd /c "../../mybatchfile.bat" which throws '..' is not recognized as an internal or external command,.
I would appreciate any guidance on that.

Related

Opening WSL terminal in current VSCode directory without using VSCode server

I've used Git Bash for most bash-required tasks before, but since I've found WSL to be much more feature-rich as it's basically an entirely new subsystem. However, when I used to use VSCode along with Git Bash, it would simply cd into the working directory of the project for ease of use. However, it doesn't do that here. The only solutions I've found online are to create an entirely new Remote WSL VSCode window, but this is way too high maintenance for what I'm trying to do as I'm literally just trying to get VSCode to automatically cd into the correct directory. Thanks in advance.

VS Code Error: spawn git ENOENT

I get the error Error: spawn git ENOENT when I try to view git history using https://github.com/DonJayamanne/gitHistoryVSCode on VS Code.. I'm very new to VS Code and github. I tried googling for solutions but I only found links about node.js which I don't understand at all..
We need to install Git to use the Git History (git log) extension in VS Code.
Otherwise we will see this when running git log.
If you have already installed Git, then make sure that it is available from the shell, for example by typing git --version.
Once you have Git installed properly, you will see this when running git log.
That means you need to set environment variable in system for git. After you set it well, the issue will disapper.
If your OS is Windows:
Try typing "git --version" in the system command line (do not use git bash by mistake). If you cannot see the version, it indicates that git is not added to the environment variables.
For example, my Git is installed on the disk "C:\", I need to add "C:\Program Files\Git" to the path of the environment variables.
Method 1:
Steps:
Edit environment variables -> System Variables
Edit Path,
add
;C:\Program Files\Git\bin\git.exe;C:\Program Files\Git\cmd;
to current value of Path (remove the beginning ; if redundant).
You need to adjust this file path according to your actual directory where git is installed.
Then restart your command line, and then try typing "git --version" again. If you can see python version now, try your vs code again, the issue you metioned will disappear.
Another method:
Reinstall your visual studio code with checking "Add to PATH (available after restart)".
I had the same issue on MacOS (running VS Cod 1.26.1). With difference to other info that I had found, I worked only after setting:
"git.path": "/usr/local/bin/git"
No success setting the path to null or any other.
I just got this error while trying to use the Worktrees tab from the GitLens extension. With git worktree list I found out I had some prunable worktrees, so it worked again after I ran this:
git worktree prune
In Mac OS you have to modify your settings.json. For me currently located in Users//Library/Application Support/Code/user/settings.json
or what it is the same ~/Library/Application Support/Code/user/settings.json
There set "git.path": "/usr/local/bin/git",
You can achieve the same inside Visual Studio Code going to the "Settings" Gear Icon > Settings Then search for git. Under Extensions go to Git and look for Path Click on Edit in settings.json
It will open the same file inside the editor
See the image for VSCODE
install git, and run git init
If you are getting this error from a React app created using Create React App, i.g. create-react-app nameOfYourApp, you need to setup CircleCI environment. More info here https://facebook.github.io/create-react-app/docs/running-tests
On your own environment
Windows (cmd.exe)
set CI=true&&npm test
set CI=true&&npm run build
(Note: the lack of whitespace is intentional.)
Windows (Powershell)
($env:CI = "true") -and (npm test)
($env:CI = "true") -and (npm run build)
Linux, macOS (Bash)
CI=true npm test
CI=true npm run build

Emacs: magit status failed on ssh remote server repo

I'm using ssh to connect to a remote server. On the server there is a git repo called MRFLSSVM. However, when I execute magit-status on:
/ssh:qmServer:/home/Chang/qmCodeLab/MRFLSSVM/
Magit asks me to Create repository in /ssh:qmServer:/home/Chang/qmCodeLab/MRFLSSVM/?.
Any idea how to let magit recognize that repo? (I've already installed git 2.10.0 on /usr/local/git and configured my system (CentOS) to use it by update-alternatives)
-----------Edit------------------------------
Error (magit): Magit requires Git >= 1.9.4, you are using 1.8.3.
If this comes as a surprise to you, because you do actually have
a newer version installed, then that probably means that the
older version happens to appear earlier on the `$PATH'. If you
always start Emacs from a shell, then that can be fixed in the
shell's init file. If you start Emacs by clicking on an icon,
or using some sort of application launcher, then you probably
have to adjust the environment as seen by graphical interface.
For X11 something like ~/.xinitrc should work.
If you use Tramp to work inside remote Git repositories, then you
have to make sure a suitable Git is used on the remote machines
too.
Error (magit): Magit requires Git >= 1.9.4, but on /ssh:qmServer: the version is 1.8.3.
If multiple Git versions are installed on the host then the
problem might be that TRAMP uses the wrong executable.
First check the value of `magit-git-executable'. Its value is
used when running git locally as well as when running it on a
remote host. The default value is "git", except on Windows
where an absolute path is used for performance reasons.
If the value already is just "git" but TRAMP never-the-less
doesn't use the correct executable, then consult the info node
`(tramp)Remote programs'.
This problem seems to be tramp is not using the correct git on remote server. I've tried to change magit-git-executable to usr/local/git/bin/git which is the path both of my local and remotes installed git. But this still doesn't work.
Any ideas to solve this? Thanks!

Chmod u+x windows cmd

I'm trying to install Scalatra on windows seven and need to change a file to executable...the Scalatra documentation says to do this, which is unix. What is the windows equivalant?
chmod u+x srt
You can simply open the relevant folder with a unix command prompt (I use git bash) and execute the unix commands from there
To get scalatra-sbt going on Windows, either port you own sbt.bat from scalatra-sbt, or install chmod via cygwin.
Assuming you've successfully installed the rest of Conscript and giter8, you can start a project that downloads scalatra-sbt. From there, one can look through the ./sbt source, and port the bash script functionality to your own windows specific script, or install a unix compatibility layer into Windows. If you go down the "windows specific script" route, perhaps the scalatra-sbt would appreciate the project contribution.
The "unix compatibility layer" route will eventually allow you to run ./sbt. chmod is a unix command line function, and is provided in a default package of the tool set cygwin, which provides a complete lunix-like environment. Once inside a cygwin terminal, you can chmod your file, as mentioned in the scalatra-sbt first project.
Diving into the contents of ./sbt from scalatra-sbt, this is actually unix script wrapper around the scala build tool (also referred to, confusingly, as sbt). If while trying to run ./sbt you get strange '\r' errors, install the cygwin package dos2unix, and then run it on the sbt file. If you run into any "which: no curl in..." or "which: no wget in..." errors, go back to the cygwin installer, find those packages such as wget, and then install those programs.
By the way, the last thing the scalatra-sbt script runs is the Scala build tool. The Scala build tool sbt itself has many reported issues with cygwin's default configuration, so you will likely need to do more research. Depending on what issues you're running into on your specific setup, you may need to make changes to the end of the ./sbt script to adjust the parameters used to launch the Scala build tool.

How to open Eclipse -- tegra development pack -- in ubuntu

After i installed "tegra development pack" on my ubuntu, the installation opened eclipse IDE for me and then i closed and then figured out that there isn't any shortcut or anything i could launch it from.
Update:
I followed "Venzen" solution till step 3 and used the filtering command. That showed me that there is another folder named "NVPACK" is located in username > NVPACK > eclipse which I didn't know about, I kept locking tipping in "eclipse" in the terminal.
Also, there is something stupid I did I would like to share; what happened here is that I kept looking at NVPACK installation folder at windows files not in linux files. (I'm using ubuntu in windows).
You could open a terminal and try to launch Eclipse from the command line:
$ eclipse
If this does not work it could mean that the eclipse binary was installed somewhere outside of your PATH and you will have to look for it. I am not familiar with Tegra, but here is a general purpose "process of elimination" to find a file in *nix:
update the locate database
$ sudo updatedb
use the which command to interrogate the updated locate database
$ which eclipse
you should have found it by now. If you haven't all is not lost - run the locate command just for good measure
$ sudo locate eclipse
locate could potentially output lots of matches since it outputs any match to your search term whether its a file or a folder. If the output of locate scrolls off the screen then use grep to filter out only matches where eclipse is a file:
$ sudo locate eclipse | grep '.*eclipse$'
If this produces several matches then choose the eclipse file which resides in a bin folder.
If, by now, a file called eclipse has not yet shown itself, then there are 2 more options left - a long way and a short way...
use the find command
post the method (or source) from where you installed
either way, kindly post here should steps 1-3 above not reveal eclipse.