![git分支命令不起作用,但其他命令可以](https://rvso.com/image/1595512/git%E5%88%86%E6%94%AF%E5%91%BD%E4%BB%A4%E4%B8%8D%E8%B5%B7%E4%BD%9C%E7%94%A8%EF%BC%8C%E4%BD%86%E5%85%B6%E4%BB%96%E5%91%BD%E4%BB%A4%E5%8F%AF%E4%BB%A5.png)
我的 Git 安裝有一個奇怪的行為。常用的 Git 指令正常運作:init
, add
, commit
, push
, pull
,但是當我鍵入任何與 相關的指令時branch
,它會報告:
C:\Program Files\Deltares\Delft3D 4.03.01\win64\util\bin\more.exe: C:Program: command not found
$ git branch
C:\Program Files\Deltares\Delft3D 4.03.01\win64\util\bin\more.exe: C:Program: command not found
有關我的設定的一些資訊:
預設安裝
根據錯誤,它與我的 Delft3D 和 more.exe 相關,但我嘗試在系統變數中找到任何角落並刪除其中包含 Delft3D 的任何項目。但它仍然不起作用。
一些有用的信息:
$ set |grep -F GIT
GIT_EXEC_PATH='C:/Program Files/Git/mingw64/libexec/git-core'
PWD=/d/Workspace/GITtest
if [ -n "${GIT_DIR-}" ]; then
test -d "${GIT_DIR-}" && __git_repo_path="$GIT_DIR";
if test -n "$GIT_TESTING_PORCELAIN_COMMAND_LIST"; then
__gitcomp "$GIT_TESTING_PORCELAIN_COMMAND_LIST";
if [ "true" = "$inside_worktree" ] && [ -n "${GIT_PS1_HIDE_IF_PWD_IGNORED-}" ] && [ "$(git config --bool bash.hideIfPwdIgnored)" != "false" ] && git check-ignore -q .; then
case "${GIT_PS1_DESCRIBE_STYLE-}" in
b="GIT_DIR!";
if [ -n "${GIT_PS1_SHOWDIRTYSTATE-}" ] && [ "$(git config --bool bash.showDirtyState)" != "false" ]; then
if [ -n "${GIT_PS1_SHOWSTASHSTATE-}" ] && git rev-parse --verify --quiet refs/stash > /dev/null; then
if [ -n "${GIT_PS1_SHOWUNTRACKEDFILES-}" ] && [ "$(git config --bool bash.showUntrackedFiles)" != "false" ] && git ls-files --others --exclude-standard --directory --no-empty-directory --error-unmatch -- ':/*' > /dev/null 2> /dev/null; then
if [ -n "${GIT_PS1_SHOWUPSTREAM-}" ]; then
local z="${GIT_PS1_STATESEPARATOR-" "}";
if [ $pcmode = yes ] && [ -n "${GIT_PS1_SHOWCOLORHINTS-}" ]; then
GIT_PS1_SHOWUPSTREAM="$value";
if [[ -z "${GIT_PS1_SHOWUPSTREAM}" ]]; then
for option in ${GIT_PS1_SHOWUPSTREAM};
upstream=${GIT_SVN_ID:-git-svn};
if [ "$GIT_COMPLETION_CHECKOUT_NO_GUESS" = "1" ] || [ -n "$(__git_find_on_cmdline "$flags")" ]; then
if test -n "$GIT_TESTING_ALL_COMMAND_LIST"; then
__gitcomp "$GIT_TESTING_ALL_COMMAND_LIST $(__git --list-cmds=alias,list-guide) gitk";
$ cat ~/.gitconfig
[user]
name = QB-LAPTOP
email = [email protected]
[gui]
recentrepo = D:/New
[filter "lfs"]
clean = git-lfs clean -- %f
smudge = git-lfs smudge -- %f
process = git-lfs filter-process
required = true
$ command -V git
git is hashed (/mingw64/bin/git)
$ git --version
git version 2.22.0.windows.1