Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git-cheetah modifying path environment variable multiple times

Tags:

git

windows

Just wanna find out if anyone has had a similar experience to this. Git seems to be modifying my path environment variable, hereafter referred to as $path, such that if after having my system running for a few days the $path is 1 huge mess!

After a clean boot $path looks something like this:

D:\WINDOWS\system32;D:\WINDOWS;D:\Apps\Development\Git\cmd;D:\Apps\Development\Android\android-sdk\platform-tools;D:\Apps\Development\phantomjs-1.9.7-windows;D:\Apps\Tools\GnuWin32\bin

When it gets to the state I mentioned it looks something like this:

D:\Apps\Development\Git\git-cheetah..\bin;D:\WINDOWS\system32;D:\WINDOWS;D:\Apps\Development\Git\cmd;D:\Apps\Development\Android\android-sdk\platform-tools;D:\Apps\Development\phantomjs-1.9.7-windows;D:\Apps\Tools\GnuWin32\bin

Except that the D:\Apps\Development\Git\git-cheetah..\bin bit is repeated, sometimes (what looks like) over 50 times!

Any insight into this would be much appreciated

like image 330
Vaughan Durno Avatar asked Jun 16 '14 14:06

Vaughan Durno


People also ask

How do you add multiple paths to Environment Variables?

In the Environment Variables window (as shown below), highlight the Path variable in the System Variable section and click the Edit button. Add or modify the path lines with the paths you want the computer to access. Each different directory is separated with a semicolon, as shown below.

How do I change my git bash path?

You need to change this Windows CMD to Git Bash. Go to File > Preferences > Settings and type shell in search settings. After that, navigate to Terminal > Integrated > Shell:Windows and update the path with Git Bash executable: C:\Program Files\Git\bin\bash.exe and save.

Can you have more than one path variable?

Luckily, it is quite easy in Spring to configure multiple path variables. All you need to do is to adapt the mapping path and to annotate all method arguments whose values are expected from the user. In this example, we configured two path variables.

What is Git_dir?

GIT_DIR is the location of the . git folder. If this isn't specified, Git walks up the directory tree until it gets to ~ or / , looking for a . git directory at every step. GIT_CEILING_DIRECTORIES controls the behavior of searching for a .


2 Answers

First of all, apologies that this is more of a workaround than an answer. I am experiencing the same exact issue. Eventually my PATH gets so large that my programs can't find anything, even as simple as XCOPY.

This is happening to me on my work computer which is under domain control and I don't have admin permissions. These instructions assume no admin access, strictly user access.

In order to avoid restarting I perform the following:

Prior to performing these steps you can open command window and run set PATH to verify that you have too many cheetahs.

  1. Go to the Environment Variables dialog (Right-Click "My Computer" -> Choose "Properties" -> Select the "Advanced" tab -> Click the "Environment Variables" button).
  2. Select "PATH" variable under the "User variables for <username>" section.
  3. Click then "Edit" button under the same section.
  4. Do nothing
  5. Click OK in the "Edit User Variable" dialog box.
  6. Click OK in the "Environment Variables" dialog box.
  7. Click OK in the "System Properties" window.

Open a NEW command window (command windows that were already open may preserve their current environment) and run 'set PATH' to verify that you're back to none or one 'cheetah's in your path.

like image 152
Benrobot Avatar answered Nov 04 '22 01:11

Benrobot


I had the same annoying problem. Just download git-cheetah source, open common/winexec.c and on line 262 change from:

if (path.len) {
    setenv("PATH", path.buf, 1);
    rec->envpath = strbuf_detach(&path, NULL);
}

to:

if (path.len) {
    if (!strstr(getenv("PATH"), gitpath))
        setenv("PATH", path.buf, 1);
    rec->envpath = strbuf_detach(&path, NULL);
}

Then, recompile (cd explorer, mingw32-make) and copy the generated dll over the existing one in Program files\Git\git-cheetah. If the file is in use you can open a console window, close the Explorer process and copy using command line; then, restart explorer using the task manager (File->Execute).

like image 38
Miguel Gimenez Avatar answered Nov 03 '22 23:11

Miguel Gimenez