340

I have PyCharm and I am looking around trying to find git.exe to set it up with my repo.

What is the PATH to git.exe?

dialex
  • 2,370
  • 7
  • 40
  • 68
Angus Moore
  • 3,741
  • 5
  • 16
  • 13
  • 7
    Why not just run a search for filename "git.exe?" – David Cain Aug 13 '12 at 05:28
  • 3
    @DavidCain: When I do a search for "git.exe" on my C: drive it finds 10 copies of that file. It looks like most of them are the same, but a couple of them are very small, presumably shortcut files? – RenniePet Sep 24 '13 at 21:24
  • @DavidCain: When I do the search, it wouldn't find it since the binaries are placed in a hidden folder (../AppData/..) which is not within the scope of the default search parameters. – Jim McAdams Aug 26 '16 at 09:32
  • 7
    On my Windows 10 system, git 2.19.0 used to be located in `C:/Program Files/Git/`, but after updating to git 2.19.1 using `git update-git-for-windows`, it was moved to `%USERPROFILE%/AppData/Local/Programs/Git/`. This caused PyCharm to complain about not finding `git.exe`. Found it again by running `where git.exe` in git bash, as suggested in the answers below. – djvg Nov 30 '18 at 07:24
  • In which version of windows? You installed as normal user or admin? – qqqqq Jul 27 '19 at 03:37
  • As a normal user on windows it is in C:\Users\XXXX\AppData\Local\Programs\Git – qqqqq Jul 27 '19 at 04:04
  • Try `dir /s /b git.exe` and grab a coffee: you will have a few git.exe to play with. The advise: use the one on `program files` or on your profile. – fcm Mar 09 '20 at 22:47

37 Answers37

512

If you're using GitHub for Windows, git.exe may not be in your PATH, but you may find it in a location like: C:\Users\<username>\AppData\Local\GitHub\PortableGit_<numbersandletters>\bin\git.exe

That's the situation for me, in Windows 7 + version 1.0 of GitHub for Windows.

In Windows 10 it appears to be in:

C:\Users\<username>\AppData\Local\GitHub\PortableGit_<numbersandletters>\cmd\git.exe

( \cmd versus \bin)

From GitHub Desktop 1.1

The UI is different and the Git path now is in:

C:\Users\<username>\AppData\Local\GitHubDesktop\app-<appversion>\resources\app\git\cmd\git.exe

PS: AppData is a hidden folder by default.

Darlesson
  • 3,864
  • 2
  • 17
  • 23
S. Kirby
  • 6,805
  • 3
  • 19
  • 22
  • 167
    Ironically, that's about the least portable place to put it...stop hiding things from me. Chrome, I'm looking at you too. – Glenn May 16 '13 at 04:21
  • 2
    Nice Thx! Worked also for me on windows 8 Pro in cmd window easy to retrieve: dir /S /P "c:\git.exe" this will give you your personal location of git.exe file – WiZarD Jun 14 '13 at 15:40
  • 13
    Ugh! that's so horrible! Whats wrong with program files?! Im just going to install git seperately. – JonnyRaa Mar 06 '14 at 10:31
  • 1
    It also turns out the git exe is quite nasty aswell - see [this post](http://superuser.com/questions/228592/adding-an-exe-to-default-path-without-adding-the-directory) for how to add it to your path – JonnyRaa Mar 06 '14 at 10:56
  • 11
    why was this so difficult – Jonesopolis Aug 26 '14 at 16:19
  • @AlexGidan Well, I only covered one particular installation case, and that's all I intended my answer to do (since I don't know other cases well enough). VonC's answer is actually the most complete one; it just takes more reading to get through. – S. Kirby Aug 31 '14 at 21:48
  • 1
    Finally! Much too difficult – cheenbabes Dec 19 '14 at 18:13
  • Crazy that they'd hide it there! Thanks for the info. – Nate Jan 22 '15 at 15:03
  • 1
    you'd think github would have a more convenient location or jetbrains would be smart enough to figure it out...sheesh – wordsforthewise May 21 '15 at 19:01
  • Worked for me - Windows 10 & Android Studio – Kris Krause Sep 10 '15 at 20:33
  • 18
    Its located in /cmd folder instead of /bin for me. I'm using Window 7 Pro SP1 & GitHub Desktop version 3.0.11.0 – Optimus Frog Dec 31 '15 at 03:12
  • 9
    i'm on windows 10 using git for windows 2.10 and they have the exe located at `C:\Users\\AppData\Local\Programs\Git\bin\git.exe` – Eric S. Nov 19 '16 at 16:35
  • 2
    Github for Windows (Electron) + Windows 10 \AppData\Local\GitHubDesktop\app-0.5.5\resources\app\git\mingw64\bin – codervince May 20 '17 at 04:53
  • 3
    Note that with GitHubDesktop there is a version number in the path, @codervince quoted. The correct path depends on you username and the installed version: `C:\Users\\AppData\Local\GitHubDesktop\app-\resources\app\git\` and than there is one `git.exe` in folder `cmd` and one in `mingw64\bin` - I did not figure the difference yet. – hajef Jun 14 '17 at 07:36
  • Lol different versions of Windows will have in either /cmd or /bin – Pranav A. Oct 06 '17 at 19:41
  • I'm not sure how my specific GitHub-for-Windows case transformed into the most popular answer, but hey. Due to the nature of this answer right now (listing several possibilities for different version/OS combos), and due to my low likelihood of personally keeping it updated, I'll make this community-wiki. – S. Kirby Aug 09 '18 at 00:06
  • Short answer for Windows: Git Bush -> `where git.exe` – Johnny Five Mar 08 '19 at 09:16
  • 1
    On version 2.21.0 and using Windows 10 the location is C:\Program Files\Git\cmd\git.exe – Cava Apr 14 '19 at 00:49
123

If git.exe is indeed in your %PATH% (that is, if you can type a git --version in a DOS windows), then which git.exe will tell you where.
(provided you did install GoW: Gnu on Windows: 130 unix commands compiled for windows, including which).

Jonny Leeds comments below that you also can use where git.exe
(except with Powershell, for you need to use where.exe git.exe, instead of the PowerShell command where)

If not, don't forget you can install git wherever you want, with the portable version of msysgit. It is just an archive you unzip in any directory of your choice.

Update 2015: use the portable version of "git-for-windows", like:

PortableGit-2.4.4.2-3rd-release-candidate-64-bit.7z.exe

Then add to %PATH%:

  • c:\path\to\PortableGit-2.4.4.2-3rd-release-candidate-64-bit\cmd
  • c:\path\to\PortableGit-2.4.4.2-3rd-release-candidate-64-bit\usr\bin

You will not only get git.exe, but also 200+ executable for Unix commands! No more GnuOnWindows to install.
See more at "Why is it that if you download Git 2.0 from the net, you always get a 1.9.4 installer package?".


More recently (2017), from Luke McGregor's answer, for the new GitHub Desktop:

"%LOCALAPPDATA%\GitHubDesktop\app-[gfw-version]\resources\app\git\cmd\git.exe"
For instance: 
%LOCALAPPDATA%\GitHubDesktop\app-1.0.1\resources\app\git\cmd
VonC
  • 1,042,979
  • 435
  • 3,649
  • 4,283
  • 8
    on windows you can use 'where' but if you are using powershell make sure to type where.exe git otherwise it will try and do something else! – JonnyRaa Mar 06 '14 at 10:24
  • @JonnyLeeds good point. I have included your comment in the answer for more visibility. – VonC Mar 06 '14 at 10:33
  • The Windows Vista and later one doesn't seem to work on my Windows 7 box. Fails on the 8.3 naming convention; just says directory not found if I go into the dirs one at a time. – Rob Grant Jul 16 '14 at 13:58
  • 1
    @RobertGrant I do confirm on my W7, it is working: `"%USERPROFILE%\AppData\Local\GitHub\PORTAB~1\bin\git.exe"` – VonC Jul 16 '14 at 14:01
  • @RobertGrant, the file path that was suggested also did not work for me...I had to change the '~1' in 'PORTAB~1' to a '~2' because the long string of numbers and letters in the 'PortableGit_..." folder name ends in a '2' for me and not a '1' character as VonC's must have for his installation. – Adam Oct 24 '14 at 23:03
  • %LOCALAPPDATA%\ is a terrible place to install an .exe file. Causing me grief pointing android studio to it, because it can't see inside this hidden folder. arghh why cant they use c:\program files like everyone else! – Hamish_Fernsby Nov 11 '17 at 20:25
  • @SolarBrian Agreed. These days, I make my own path https://stackoverflow.com/a/47172186/6309, in addition of GitHub Desktop. – VonC Nov 11 '17 at 20:27
  • @VonC: After installing git for windows (non-portable), I find `git.exe` in four different folders: `git/bin/`, `git/cmd/`, `git/mingw64/bin/` and `git/mingw64/libexec/git-core/`. Do you know which one I should use, e.g. when I want to call git using Python's `subprocess`? I suppose either the one in `cmd/` or the one in `bin/` but is there a difference? – djvg Dec 12 '18 at 07:58
  • 1
    @Dennis `bin/` is enough. `cmd/` would be useful only as a folder added to the `%PATH%` in a `CMD` session. – VonC Dec 12 '18 at 08:07
66

I'm very surprised to see that no one mentioned using the --exec-path switch.

git --exec-path

C:\Program Files\Git\mingw64/libexec/git-core

I hope this helps someone.

Community
  • 1
  • 1
wjamyers
  • 761
  • 5
  • 5
  • 5
    Not quite. On Windows, that would give me: `D:\prgs\git\latest\mingw64/libexec/git-core`, where there is indeed a `git.exe`, but not the one I use. `where git.exe` gives me the correct location: `D:\prgs\git\latest\bin\git.exe`. You can see the difference between the two in the comment of https://github.com/git/git/commit/53876fcf3fdc1c46c26fc3a191e74a06e633d5b2. exec-path reference what is called the "helper directory". – VonC Aug 09 '17 at 21:15
  • This is really interesting answer, but it does give somewhat different result than e.g. `where git`. Also --exec-path gives slashes instead of back-slashes. – Lauri Apr 05 '19 at 10:34
  • 2
    umm why isn't this at the top of the list? – Tobias Feil May 31 '19 at 07:54
  • This worked perfectly for me. @VonC , If you navigate to that directory you listed: C:\Program Files\Git\mingw64\libexec\git-core you should see a file, git.exe within the directory. So the full path would be: C:\Program Files\Git\mingw64\libexec\git-core\git.exe Did that not work for you? – LastTigerEyes Nov 14 '19 at 21:35
  • @LastTigerEyes Not Program files, because I uncompress the portable archive elswhere, but yes, that does ends with `mingw64\libexec\git-core\git.exe` – VonC Nov 14 '19 at 22:30
  • 1
    This flag is very useful, just keep in mind that the executable will be in the root directory + /bin – d_scalzi Feb 13 '20 at 18:43
  • Just FYI. I'm, using 'System.Diagnostics.Process' to automate git and find out that using the default path make `process` to end before gives any answer. I'm assuming that `git.exe` call the `..\git-core\git.exe`. Using the .exe pointed by --exec-path works fine. – fcm Mar 09 '20 at 22:44
  • perfect answer! I was looking for something generic that would work for different situations and not just "the standard directory where git is supposed to be installed", which can vary for any specific case. +1 – umbe1987 Feb 22 '21 at 15:48
39

Just to add to a couple of answers already here:

On Windows, you can use the built in "where" instead of "which" (which is for Linux). So, where git will tell you the location of git assuming that it is in the system path.

If it is not in the system path, and you want a native (no downloads or installations), reasonable time command to find it, use dir /s git.exe

SterlingDragon
  • 563
  • 4
  • 5
  • 2
    on windows 10 and within a mingw64 shell, `which git` returned a virtual location: `/mingw64/bin/git`. while `where git` returned two actual locations on the c drive: `C:\Users\\AppData\Local\Programs\Git\mingw64\bin\git.exe` and `C:\Users\\AppData\Local\Programs\Git\cmd\git.exe` – worc Oct 09 '17 at 17:34
23

If you use SourceTree, one instance can be found here:

%USERPROFILE%\AppData\Local\Atlassian\SourceTree\git_local\bin

You can also install quickly via chocolatey. choco install git which will then make it available on your path without any further work on your part.

weston
  • 51,132
  • 20
  • 132
  • 192
16

Here are step by step instructions for you to find out:

  1. If you're using any version of Windows, do Ctrl - Shift - Esc of open Task Manager.
  2. Open GitHub, and look into Task Manager.
  3. There should be something like this: What's in Task Manager when GitHub is open.
  4. Right click the row called GitHub, and select "Open file location".
  5. A window should pop up, showing you where the file is. Github.exe found!


There you go!

You can do this with any application, not just GitHub.

Community
  • 1
  • 1
WorkingRobot
  • 405
  • 8
  • 18
15

type in the command line:

where git.exe
Randall Flagg
  • 4,212
  • 7
  • 30
  • 43
14

If you can use the git command it should be in your path? thus this should work asuming linux or linux like os

which git

else also asuming linux like os

cd /
find . -name "*git*"

if on windows tell me what version you are using and I'll help you. The default path on windows is C:\Program Files (x86)\Git.

The name of the executable is not git.exeon all systems.

Pablo Jomer
  • 7,990
  • 6
  • 45
  • 86
10

It seems like git.exe can be found in different places depending on how it was installed, the version, and version of Windows.

I installed Git-2.6.3-64-bit.exe (cleand install; just git, not the Github Desktop client) on Windows 10 Pro N. This is the default location:

%USERPROFILE%\AppData\Local\Programs\Git\mingw64\bin\git.exe

and

%USERPROFILE%\AppData\Local\Programs\Git\bin

S.Norrbjörk
  • 141
  • 1
  • 4
7

C:\Users\<username>\AppData\Local\GitHub\PortableGit_<random hash>\cmd\git.exe is where my git.exe is located on Windows 10, Git version 2.10.0.0

Edit: With GitHubDesktop, the location changed to this

C:\Users\<username>\AppData\Local\GitHubDesktop\app-1.0.1\resources\app\git\cmd

or the easier way

%USERPROFILE%\AppData\Local\GitHubDesktop\app-1.0.1\resources\app\git\cmd
trevren11
  • 172
  • 3
  • 10
5

Well I just searched for git.exe on my Windows.
Many files returned with names like git-something.exe and git-somethingElse.exe.
Out of those I could find a file with the exact name git.exe. I opened the file and could see cmd with various git commands, which made me decide that it's the correct one.
Pasted the file's path (below) to PyCharm and it worked.

C:\Users\*Username*\AppData\Local\GitHub\PortableGit_cba306e536fdf878271f7fe636a147f7326ad\cmd\git.exe

PS: I installed Git and GitHub through Windows the GitHub's Client Installation.

akshaynagpal
  • 2,139
  • 28
  • 29
5
Install git first to your window from

https://git-scm.com/download/win

 Select this path while configuring with git to Android studio
    C:\Program Files\Git\cmd\git.exe
5

Sometimes it can be at: C:\Users\user-name\AppData\Local\Programs\Git\cmd. Checking your PATH environment variable for USER and for SYSTEM can give you that.

Binyamin Regev
  • 799
  • 2
  • 15
  • 26
  • while my path for git for windows is different on 8.1 /10 this answer helped me. I was selecting the wrong file. it should be exactly `git.exe` it was located in cmd/ directory. this answer helped me out. – Abhishek Dujari May 26 '20 at 17:13
4

In Windows 7 on GitHub 2.5.3.0 I found it in C:\Users(user)\AppData\Local\GitHub\PortableGit_(numbers)\mingw32\bin\git.exe

thanks to dir /s git.exe

Radek O
  • 398
  • 1
  • 3
  • 12
4

Appears to have moved again in the latest version of GH for windows to:

%USERPROFILE%\AppData\Local\GitHubDesktop\app-[gfw-version]\resources\app\git\cmd\git.exe

Given it now has the version in the folder structure i think it will move every time it auto-updates. This makes it impossible to put into path. I think the best option is to install git separately.

Not loved
  • 30,848
  • 21
  • 111
  • 180
4

Check this path:

C:\Program Files\Git\mingw64\libexec\git-core\git.exe
Sorul
  • 137
  • 8
3

If you've got the PowerShell-based git installation, you can use the Get-Command object to find git:

Get-Command git.exe | Select-Object -ExpandProperty Definition
MikeB
  • 1,214
  • 10
  • 23
3

On Windows 10:

I installed git from - https://git-for-windows.github.io/.

After installation i found it at C:\Program Files\Git\bin\git.exe

olagu
  • 467
  • 4
  • 8
  • I answered the question cause I am using a 64Bit machine with windows 10 and above is the result of my installation which I did not find in the answer to the question. I am puzzled by seeing a -1 on my answer? Could anyone explain to me why it was downvoted? – olagu Aug 03 '17 at 06:17
  • 2
    Not sure why, this seems accurate. +1 – VonC Aug 03 '17 at 06:53
  • it's an inaccurate and incomplete answer. i don't know if it's a group policy or a configuration chosen during installation, but that git installer when run on windows 10 does under certain circumstances install to `C:\Users\\AppData\Programs\` instead of `C:\Program Files` – worc Oct 09 '17 at 17:33
  • Note that the question is about Git**Hub** for Windows, not *git for Windows*. – Bram Vanroy Feb 07 '18 at 13:29
3

For anyone who might not find the other solutions suitable,

I just today downloaded the newest version and the git.exe was located in

C:\Users\<user>\AppData\Local\GitHubDesktop\app-1.0.10\resources\app\git\cmd
Bill Souvas
  • 46
  • 2
  • 6
2

If you have msysgit installed, the path would look like c:\Program Files (x86)\Git\bin\git.exe on a 64-bit system, otherwise just download and install it, PyCharm doesn't come with Git client.

CrazyCoder
  • 350,772
  • 137
  • 894
  • 800
  • PyCharm does come with an option to use github for all documents. – Angus Moore Sep 11 '12 at 11:58
  • @AngusMoore, GitHub integration uses GitHub API and doesn't depend on git binary, but you still need git installed on the local machine to clone projects and commit/push. – CrazyCoder Sep 11 '12 at 12:10
  • For those who installed git extensions (windows) this is also the default location of git.exe – Shahar Mar 31 '16 at 20:34
2

GitHub Desktop team member here

What is the PATH to git.exe?

The version of Git used in GitHub Desktop (or GitHub for Windows) is not intended to be used directly by users, as the path will changes between updates and it might lack some features you need.

I recommend installing Git for Windows which will be installed at a predictable location under C:\Program Files\Git\cmd\git.exe.

Brendan Forster
  • 2,067
  • 1
  • 17
  • 29
1

First ,you should install github in your PC; Second,you can download the tool 'Everything'; Third,open the tool everything ,type git.exe,then you will find the location and copy the location to PyCharm ,and Test,you will see successfully!

Stawman
  • 31
  • 4
1

In windows 8 I found its path as below:

enter image description here

C:\Program Files (x86)\Git\bin\git.exe

Abdul Majeed
  • 2,275
  • 18
  • 25
1

On windows if you have git installed through cygwin (open up cygwin and type git --version to check) then the path will most likely be something like C:\cygwin64\bin\git.exe

2016rshah
  • 651
  • 6
  • 19
1

I am working on OSX, and saw this issue. I found xcode disabled git, causing me to agree to the T&Cs again. I fixed by:

  1. in a terminal window, within my project folder: git status
  2. I recieved the following log entry: Agreeing to the Xcode/iOS license requires admin privileges, please re-run as root via sudo.
  3. I ran the following: sudo git status
  4. I then agreed to the T&Cs and everything was hunky dory
Nathan Tregillus
  • 5,248
  • 2
  • 43
  • 73
1

I found it at

C:\Users\~\AppData\Local\GitHub\PortableGit_<some_identifier>\mingw32\libexec\git-core\
pacholik
  • 7,596
  • 8
  • 43
  • 50
Gautham
  • 591
  • 7
  • 12
1

If you are using Git For Windows then it is located at

C:\Program Files\Git\mingw64\libexec\git-core

It is nice to have in mind that Git For Windows offers Git CMD, a command prompt with the PATH already set. Git CMD is available as a shortcut in

Start Menu > Programs > Git

among other options.

dpant
  • 1,375
  • 13
  • 27
1

Using

  • Git 2.11.0,
  • Windows 10,
  • Android studio 2.2

git.exe location:

C:\Users\<.username>\AppData\Local\Programs\Git\cmd\git.exe

Suggestion: while Installing, copy the git path

Prabs
  • 4,376
  • 6
  • 34
  • 55
1

After running through this for all answers, did not find path though.
The latest githubdesktop.exe for windows 10 goes into this directory:

C:\ProgramData\<User>\GitHubDesktop\app-1.0.13\GitHubDesktop.exe
Dmitriy
  • 5,347
  • 12
  • 23
  • 37
1

Try looking in C:\Program Files\Git\bin. I have been able to use git.exe located there to setup my repository with PyCharm.

nowox
  • 19,233
  • 18
  • 91
  • 202
0

I have downloaded stub from https://desktop.github.com After installation of the git from the stub, git.exe is stored in the following location.

C:\Users\**User Name**\AppData\Local\GitHub\PortableGit_****Some No/characters***\cmd\git.exe

In Windows 10 64 bit, I feel the exe file is now stored in cmd folder rather than bin folder.

Doogle
  • 1,039
  • 1
  • 14
  • 16
0

If you've downloaded the latest version try looking in the CMD folder. git.exe should be in there and should work. You may have to input it's path manually with File>Settings>Version Control>Git

Josh
  • 1,132
  • 15
  • 20
0

I am using Windows 10, Pycharm 2016.1.2 and here is the path that i found Github.exe at: (please note that the bold part is variable and you should replace it with applicable values...)

C:\Users**Salman**\AppData\Local\GitHub\PortableGit_c2ba306e536fdf878271f7fe636a147ff37326ad\bin\git.exe

0

For me on Windows 10: C:\Users\Paul\AppData\Local\GitHub\PortableGit_624c8416ee51e205b3f892d1d904e06e6f3c57c8\mingw32\bin\git.exe

paull
  • 21
0

Locating and setting Git Path

  • To Locate git.exe inside your Git-software installation directory.

The location for git.exe will vary depending on what Git-software you have installed! The git.exe file is located inside your Git-software installation directory, usually inside a folder called bin. Some examples of standard locations: Software Standard location Git C:\Program Files (x86)\Git\bin SmartGit C:\Program Files (x86)\SmartGit\git\bin\git.exe GitHub For Windows C:\Users\'username'\AppData\Local\GitHub\PortableGit_'numbersandletters'\cmd\git.exe

-Path Setting for Git

Set the git.exe path in the PATH environment variable

Right-click My Computer on your desktop or start-menu, and select Properties. Click the Advanced system settings tab. Click the Environment Variables button. Under System Variables, click PATH (can also be called Path) and click Edit. Paste the location to your git.exe* and ok.

M A
  • 1
0

C:\Users\\AppData\Local\GitHub\PortableGit_\cmd\git.exe

This is the location that worked for me. I was unable to use git from the shell as well. Setting the above location as the path fixed that issue.

lord AJ
  • 5
  • 4
0

I am working with GitHub Desktop 1.0.13 and I wanted to add git.exe to my Intellij ennvironment. I have found it in C:\Users\Adam\AppData\Local\GitHubDesktop\app-1.0.13\resources\app\git\mingw64\bin\git.exe

  • 2
    When adding answers to an older question it is helpful to explain how you answer differs from the existing answers and indicate which new information you are adding that applies to the question. – Jason Aller Feb 04 '18 at 19:29