2015 年 11 月 25 日更新。
无论如何,GitHub Desktop(最终)使用了更新的 git 版本:2.5。看布伦丹·福斯特推特 https://twitter.com/shiftkey/status/669375487681040384.
原始答案(2015 年 11 月上旬)
首先,最新的gitWindows 版本可在 GitHub 上获取 https://github.com/git-for-windows/git/releases.
我总是使用存档便携式形式(解压缩到我想要的任何地方,并添加到PATH
).
但如果你选择了exe
setup,这意味着它已经安装在C:\Program Files\Git
.
然而,正如我在这里提到的 https://stackoverflow.com/a/11928949/6309,git也包含在GitHub Desktop自带的安装路径中(%USERPROFILE%\AppData\Local\GitHub\PORTAB~1\bin
)
理论上,您可以用目录 JUNCTION 替换文件夹 PORTAB~1 的确切值:
cd %USERPROFILE%\AppData\Local\GitHub
dir # take note of the exact name of PORTABLEGIT folder: <PORTAB...>
move <PORTAB...> old_PORTABLEGIT
mklink /J <PORTAB...> "C:\Program Files\Git"
在我最新的 GitHub Desktop 3.0.7.1 3397ae4 中,我看到:
C:\Users\vonc\AppData\Local\GitHub\PortableGit_c2ba306e536fdf878271f7fe636a147ff37326ad\bin
然而,这是行不通的:当再次启动 GitHub Desktop 时,它会检测到更改并恢复其自己的嵌入式 Git 版本 (1.9.5)
所以你不能轻易强制 GitHub Desktop 使用另一个 git 版本。
即使您能够以某种方式强制 GitHub for Desktop 使用另一个版本的 Git,您也必须仔细报告其自己的内部 git 系统配置:
C:\Users\vonc\AppData\Local\GitHub\PortableGit_c2b...\etc\gitconfig
此文件指向 GitHub Desktop 特定设置:
[http]
sslcainfo = /bin/curl-ca-bundle-ghfw.crt
[credential]
helper = !github --credentials
[filter "ghcleansmudge"]
clean = cat
smudge = cat
这些设置是not存在于非 GitHub 嵌入版本的 Git 中,并且需要恢复。