git.exe 位于何处?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/11928561/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 14:22:31  来源:igfitidea点击:

Where is git.exe located?

gitgithub-for-windows

提问by Angus Moore

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

我有 PyCharm,我正在四处寻找 git.exe 来使用我的 repo 进行设置。

What is the PATH to git.exe?

git.exe 的路径是什么?

回答by S. Kirby

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

如果您使用GitHub for Windows,则 git.exe 可能不在您的 PATH 中,但您可能会在以下位置找到它: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.

这就是我的情况,在 Windows 7 + GitHub for Windows 1.0 版中。

In Windows 10 it appears to be in:

在 Windows 10 中,它似乎位于:

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

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

( \cmd versus \bin)

( \cmd 对 \bin)

From GitHub Desktop1.1

GitHub 桌面1.1

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

UI 不同,现在 Git 路径在:

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

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

PS:AppDatais a hidden folder by default.

PS:AppData默认是隐藏文件夹。

回答by VonC

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

如果git.exe确实在你的%PATH%(也就是说,如果你可以git --version在DOS窗口中键入a ),那么which git.exe会告诉你在哪里。
(前提是您确实在 Windows 上安装了GoW:Gnu:为 Windows 编译的 130 个 unix 命令,包括which)。

Jonny Leedscomments belowthat 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)

您也可以使用下面的Jonny Leeds评论where git.exe
(Powershell 除外,因为您需要使用where.exe git.exe,而不是PowerShell 命令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.

如果没有,不要忘记你可以在任何你想要的地方安装 git,使用 msysgit 的便携版. 它只是您在您选择的任何目录中解压缩的存档。

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

2015 年更新:使用便携式版本的 "git-for-windows",例如:

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

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

Then add to %PATH%:

然后添加到 %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
  • 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?".

您不仅可以获得git.exeUnix 命令,还可以获得200 多个可执行文件!不再需要安装 GnuOnWindows。
请参阅“为什么如果您从网上下载 Git 2.0,您总是会得到 1.9.4 安装程序包?”。



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

最近(2017 年),来自Luke McGregor回答,对于新的GitHub 桌面

"%LOCALAPPDATA%\GitHubDesktop\app-[gfw-version]\resources\app\git\cmd\git.exe"
For instance: 
%LOCALAPPDATA%\GitHubDesktop\app-1.0.1\resources\app\git\cmd

回答by wjamyers

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

我很惊讶地看到没有人提到使用 --exec-path 开关。

git --exec-path

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

git --exec-path

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

I hope this helps someone.

我希望这可以帮助别人。

回答by SterlingDragon

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 gitwill tell you the location of git assuming that it is in the system path.

在 Windows 上,您可以使用内置的“where”而不是“which”(适用于 Linux)。所以,where git假设它在系统路径中,会告诉你 git 的位置。

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

如果它不在系统路径中,并且您想要本机(无需下载或安装),合理的时间命令来找到它,请使用 dir /s git.exe

回答by weston

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

如果您使用SourceTree,可以在此处找到一个实例:

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

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

您还可以通过Chocolatey快速安装。choco install git这将使其在您的路径上可用,而无需您做任何进一步的工作。

回答by ProgramFast

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

以下是分步说明供您了解:

  1. If you're using any version of Windows, do Ctrl - Shift - Escof 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!
  1. 如果您使用的是任何版本的 Windows,请Ctrl - Shift - Esc打开任务管理器。
  2. 打开 GitHub,然后查看任务管理器。
  3. 应该有这样的事情: GitHub 打开时任务管理器中的内容。
  4. 右键单击名为 的行GitHub,然后选择“打开文件位置”。
  5. 应该会弹出一个窗口,显示文件所在的位置。 Github.exe 找到了!


There you go!


你去吧!

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

您可以使用任何应用程序执行此操作,而不仅仅是 GitHub。

回答by Randall Flagg

type in the command line:

在命令行中输入:

where git.exe

回答by Pablo Jomer

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

如果您可以使用 git 命令,它应该在您的路径中吗?因此这应该适用于 linux 或 linux like os

which git

else also asuming linux like os

否则也假设像 os 这样的 linux

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.

如果在 Windows 上告诉我你使用的是什么版本,我会帮助你。Windows 上的默认路径是 C:\Program Files (x86)\Git.

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

可执行文件的名称并非git.exe在所有系统上都有。

回答by S.Norrbj?rk

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

似乎 git.exe 可以在不同的地方找到,具体取决于它的安装方式、版本和 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:

我在 Windows 10 Pro N 上安装了 Git-2.6.3-64-bit.exe(干净安装;只是 git,而不是 Github 桌面客户端)。这是默认位置:

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

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

and

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

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

回答by trevren11

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

C:\Users\<username>\AppData\Local\GitHub\PortableGit_<random hash>\cmd\git.exe是我的 git.exe 在 Windows 10 上的位置,Git 版本 2.10.0.0

Edit:With GitHubDesktop, the location changed to this

编辑:使用 GitHubDesktop,位置更改为此

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