问题
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?
回答1:
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.
回答2:
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
回答3:
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
回答4:
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.
回答5:
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.
回答6:
Here are step by step instructions for you to find out:
- If you're using any version of Windows, do
Ctrl - Shift - Esc
of open Task Manager. - Open GitHub, and look into Task Manager.
- There should be something like this:
- Right click the row called
GitHub
, and select "Open file location". - A window should pop up, showing you where the file is.
There you go!
You can do this with any application, not just GitHub.
回答7:
type in the command line:
where git.exe
回答8:
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.exe
on all systems.
回答9:
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
回答10:
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
回答11:
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.
回答12:
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.
回答13:
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
回答14:
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
回答15:
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
回答16:
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
回答17:
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
回答18:
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.
回答19:
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!
回答20:
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
回答21:
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:
- in a terminal window, within my project folder:
git status
- I recieved the following log entry:
Agreeing to the Xcode/iOS license requires admin privileges, please re-run as root via sudo.
- I ran the following:
sudo git status
- I then agreed to the T&Cs and everything was hunky dory
回答22:
I found it at
C:\Users\~\AppData\Local\GitHub\PortableGit_<some_identifier>\mingw32\libexec\git-core\
回答23:
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.
回答24:
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
回答25:
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
回答26:
Try looking in C:\Program Files\Git\bin
. I have been able to use git.exe
located there to setup my repository with PyCharm.
回答27:
👋 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
.
回答28:
Check this path:
C:\Program Files\Git\mingw64\libexec\git-core\git.exe
回答29:
In windows 8 I found its path as below:
C:\Program Files (x86)\Git\bin\git.exe
回答30:
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.
来源:https://stackoverflow.com/questions/11928561/where-is-git-exe-located