集成 Git-For-Windows 后,我在 MSYS2 启动时收到此错误:bash: create-shortcut.exe: command not find

问题描述 投票:0回答:2

我安装了

msys2
,然后通过应用
这个简单的过程
,将
Git-For-Windows
的安装集成到msys2环境中。

这样做后,当我双击

msys2
桌面图标时,出现此错误:

bash: create-shortcut.exe: command not found
bash: create-shortcut.exe: command not found

jdoe@msys2$

我可以看到上述错误的根源。

上述过程创建了这个新脚本 -

/etc/profile.d/git-sdk.sh
- 它尝试运行
create-shortcut.exe
命令;但是(就像脚本一样)我找不到
create-shortcut.exe
在哪里。

有谁知道

create-shortcut.exe
来自哪里(
MSYS2
MS-WINDOWS
),或者它可能位于哪里?或者甚至知道解决这个问题的方法是什么? =:)

windows git-bash msys2
2个回答
2
投票

谢谢评论者。

这是一个错误,要么是因为引用的命令未包含在包中,要么是因为该命令不在脚本的

PATH
中。我将在
GitHub
项目中为此提交一个问题。

特别感谢

@HolyBlackCat
指出该过程不是必需的,因为
git(1)
已经在
MSYS2
的默认存储库中可用。 (我是
MSYS2
的新手,因为我获得了
Windows
环境而不是
Linux
)。因此,我最终取消了该过程并安装了本机存储库版本,效果很好。

但是,如果您确实想保留该过程提供的版本——因为它确实提供的不仅仅是

git(1)
命令(例如,它也有一个
SDK
)——那么您可以简单地找到并安全地注释掉
/etc/profile.d/git-sdk.sh
RC 脚本中的违规部分,其唯一目的是创建
Windows
桌面图标。希望这对其他人有帮助。


0
投票

实际上,当您启动

C:\git-sdk-64\git-bash.exe
时,不会弹出错误,它会在桌面上创建自己作为快捷方式,这就是这些行的作用。您可能尝试使用带有 init 命令
C:\git-sdk-64\usr\bin\bash.exe --login -i
和图标
C:\git-sdk-64\mingw64\share\git\git-for-windows.ico
的 Windows 终端。

编辑

/etc/profile.d/git-sdk.sh
不是最好的主意。最好调整用户的
.bash_profile
以将
PATH
包含到
create-shortcut.exe
,但将
export PATH="/mingw64/bin:$PATH"
放入文件中并没有帮助,因为
create-shortcut.exe
被调用得更早。

看来

/etc/profile
加载
git-sdk.sh
并且您跳过的
git-bash.exe
包装器正在设置
PATH="/mingw64/bin:$PATH
以使
create-shortcut.exe
工作,我认为。

幸运的是,当

git-sdk.sh
被获取时,
PATH
已经包含
/usr/local/bin
,因此您可以通过管理 shell 将 exe 符号链接到该路径:

MSYS="winsymlinks:nativestrict"
mkdir -p /usr/local/bin
ln -s /mingw64/bin/create-shortcut.exe /usr/local/bin/

现在错误在任何终端中都消失了,无需触及任何 shell 脚本。

© www.soinside.com 2019 - 2024. All rights reserved.