我在工作中使用 Git(在 Windows 8 上),但我们在 AD 中有一个名为“HomeDrive”的变量,它被烦人地设置为网络驱动器。Git 决定在这里安装 git bash 和其他实用程序,这非常烦人。我想知道是否可以进入 Git 并编辑$HomeDrive
和$HomePath
变量以使 Git 从 C 驱动器运行。另外,如果这是错误的网站,请原谅,但我不确定它是 SO 还是 SU
这是我在“设置”文件上能找到的最佳内容:
@rem Do not use "echo off" to not affect any child calls.
@rem Enable extensions, the `verify other 2>nul` is a trick from the setlocal help
@verify other 2>nul
@setlocal enableDelayedExpansion
@if errorlevel 1 (
@echo Unable to enable delayed expansion. Immediate expansion will be used.
@goto fallback
)
@rem Get the absolute path to the parent directory, which is assumed to be the
@rem Git installation root.
@for /F "delims=" %%I in ("%~dp0..") do @set git_install_root=%%~fI
@set PATH=!git_install_root!\bin;!git_install_root!\mingw\bin;!PATH!
@if not exist "!HOME!" @set HOME=!HOMEDRIVE!!HOMEPATH!
#messing about with this does nothing
@if not exist "!HOME!" @set HOME=!USERPROFILE!
@start "gitk" wish.exe "!git_install_root!\bin\gitk" -- %*
@goto end
:fallback
@rem The above script again with immediate expansion, in case delayed expansion
@rem is unavailable.
@for /F "delims=" %%I in ("%~dp0..") do @set git_install_root=%%~fI
@set PATH=%git_install_root%\bin;%git_install_root%\mingw\bin;%PATH%
@if not exist "%HOME%" @set HOME=%HOMEDRIVE%%HOMEPATH%
@if not exist "%HOME%" @set HOME=%USERPROFILE%
@start "gitk" wish.exe "%git_install_root%\bin\gitk" -- %*
:end
@rem End of script