configure git in pycharm through WSL - python-3.x

It seems like something went wrong when I set git inside pycharm like this:
my git installed inside WSL is version-2.17.1; pycharm is professional version

You can't directly invoke Linux programs from a Win32 program like this. You may have better luck creating a batch file that invokes the wsl binary and use that. Something like the following in the batch file may be useful:
wsl git %*
Then invoke your batch file as the Git binary.
Do note that your Linux Git binary will expect Unix paths, not Win32 paths, so if you can't guarantee that Unix paths will be passed, you'll need to either switch both your editor and Git to be Linux programs, switch them both to be Windows programs, or not use Git inside your editor.

Related

Access linux paths in windows git powershell

I am running a Windows Powershell provided through the git for windows installation. This shell provides many unix style commands (i.e. "ls", "mv", etc.).
My question is: How do I access Unix style paths from the powershell cmd line on Windows?
Consider this example: the "ls" program is installed and works in the powershell. The path is shown as "/usr/bin/ls" if I type "which ls" as the cmd prompt. But if I try to change my current directory using "cd /usr/bin/", the shell complains that the path is not found.
I can't see any mounted volumes or anything like that using "mount" (perhaps in PowerShell it is a different command?).
I'm asking this question because I have other files that I need to get to which are listed under unix-style paths, and right now I can't get to anything. I figure if I can get to /usr/bin, then I can figure out how to get where I really need to go.
Powershell is not Unix. It may have a few familiar commands like "ls" and "ps", but that's where the similarity ends.
When you installed Git For Windows, you likely installed the Git Bash shell as well. Run that instead to get a more Unix like atmosphere. (Re-install Git For Windows if you didn't select this option on install).
But even with Git Bash, there's still no such folder as /usr/bin. That folder doesn't exist on Windows. If you want a Unix emulation on Windows that includes the traditional folder structure, use Cygwin. And you can run Git on that environment too and access an emulated /usr/bin folder.

Cygwin git and git bash path confusion

So I wanted to install some vim plugins using Vundle, I got everything set up, ran PluginInstall command and got this:
fatal: Unable to create temporary file: Result too large
I should mention that I have both git-bash and cygwin git package installed on my environment.
I did some googling and found that I shouldn't use windows version of git through cygwin, installed cygwin git package, tried again to no avail. Turns out even though I have installed the cyg pkg, cygwin is still using the git-bash one.
I tried manually pulling the plugin with cygwin's git version and it worked. So how do I force cygwin to use it's own package. In my user path variable resides only cygwin's bin folder, git-bash is in the system's path variable. How do I force the user path one to take precedence over the git-bash version? Shouldn't that be the dafault behaviour?
https://askubuntu.com/questions/58814/how-do-i-add-environment-variables
Seems to do the trick, I don't know if that is the optimal solution but it works. I just plugged this into my bashrc.
export PATH="C:\cygwin64\bin"

Calling groovy execute cross platform

I am currently using gmaven plus to run a groovy command inside maven.
The command (for the sake of example) would be
git help
If I run it on linux I can do:
'git help'.execute().text.trim()
This however doesn't work on windows. Instead I need to do:
'cmd /C git help'.execute().text.trim()
Is there a cross platform way of doing this?
Seeing that it worked for others got me thinking and indeed the problem was with my own PATH configuration;
Apparently, if you define git in the path as follows:
"C:\Program Files (x86)\Git\bin"
then when running from command it will find git. However, groovy will NOT find it.
On the other hand, if you define git in the path as follows:
C:\Program Files (x86)\Git\bin
i.e. without the "". Then everything works fine.
see also https://serverfault.com/questions/349179/path-variable-and-quotation-marks-windows

How git-svn or git-flow commands are executed without dash in between

When installing git-flow I realized it is just putting files in /usr/local/bin mainly git-flow which is the executable, I'm able to invoke the script git-flow by running git flow (without dash in between). I then realized it is the same with git-svn as well where the commands are run with git svn.
Am I overlooking something basic or does git itself actually delegate the commands somehow?
The git binary remembers the directory where dashed executables like git-svn are installed. It is set during git installation, or to be more exact during build phase (that is why you need to use the same options compiling and installing).
You can find this directory with git --exec-path
$ git --exec-path
/usr/libexec/git-core
(the above is for system installation on Linux).
The git svn command (not a built in) invokes git wrapper, which finds git-svn binary, and executes it.
Note: some of dashed executables, corresponding to built-in commands, like git-tag, are hardlinked to git executable. Calling those just invokes appropriate (sub)command.

Run build script in Code::Blocks instead of building a target

Background:
I recently joined a software development company as an intern and am getting used to a new build system. The software is for an embedded system, and lets just say that all building and compiling is done on a buildbox. The building makes use of code generation using xml files, and then makes use of make files, spec files, and version files as well.
We develop on our own comps, (linux - mandriva distro) and build using the following methods:
ssh buildserver
use mount to mount drive on personal computer to the buildserver
set the environment using . ./set_env (may not be exactly that)
cd app_dir/obj (where makefile is)
make spec_clean
make spec_all
make clean
make
The Question:
I am a newbie to Code::Blocks and linux and was wondering how to set up a project file so that it can simply run a script file to execute these commands, instead of actually invoking the build process on my actual computer. Sort of like a pre-build script. I want to pair the execution of this script simply to Ctrl-F9 (build) and capture any output from the above commands in the build log window.
In other words, there is no build configuration or target that the project needs to worry about. I don't even need a compiler installed on my computer! I wish to set this up so that I can have the full features of an IDE.
Appreciate any suggestions!
put your script in a shell script file. E.g.,
#!/bin/sh
mount ... /mnt/path/buildserver
. ./set_env
cd app_dir/obj
make spec_clean
make spec_all
make clean
make
Say you name it as /path/to/my_build_script, then chmod 755 /path/to/my_build_script and invoke the following from your ssh client machine:
script -c ssh buildserver "path/to/my_build_script"
When finish, then check for the file typescript under current directory.
HTH

Resources