Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I install Git for Windows software to a specific directory?

Tags:

git

bash

windows

I have just downloaded the latest Git for Windows installer, v2.4. It appears to want to install to the standard Windows "Program files" (with-spaces-in-name) directory.

Since I have all my development code in a folder called (simply) "/bin" -- I want to see if there's a command line option or parameter to change the install directory.

In my case, these days I use a environment variable such as GIT_HOME for important software like git; so it would be useful if there was a way to apply that to things like git commands, etc once I have the program installed.

possibly related:

  • How do I change the directory in Git Bash with Git for Windows?

I also came across a few questions asking: "whereis git". That's answered above, however I take that as an indicator that others may want git somewhere else too.

like image 490
will Avatar asked Feb 02 '16 06:02

will


People also ask

How do I change where Git installs?

The default path is “C:\Program Files\Git“. If you want the software installed in a different location click Browse and specify a different folder. Click Next when ready to proceed. On this step, you are prompted to provide the name of the Start Menu folder in which the shortcuts for the application will be placed.

Where is my Git installation directory Windows?

The default path on windows is C:\Program Files (x86)\Git . The name of the executable is not git.exe on all systems. Show activity on this post. It seems like git.exe can be found in different places depending on how it was installed, the version, and version of Windows.

How do I manually install Git?

To install Git, navigate to your command prompt shell and run the following command: sudo dnf install git-all . Once the command output has completed, you can verify the installation by typing: git version .


1 Answers

To start the installer with a different installation path you can open a CMD terminal in the same directory as the installer executable and pass in an option parameter of /DIR="x:\dirname"

For instance, if you have version 2.17.0 for Windows 64bit and you want to install git to D:\git, you would run:

Git-2.17.0-64-bit.exe /DIR="D:\git"

The installer will launch as usual and you need to walk through the other options, but the install location will be the path specified.

like image 139
James Avatar answered Oct 20 '22 13:10

James