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

发布于 2025-01-11 16:33:08 字数 646 浏览 0 评论 0原文

我安装了 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 来自哪里(MSYS2MS-WINDOWS),或者它可能位于何处?或者甚至知道解决这个问题的方法是什么? =:)

I installed msys2, and then integrated the installation of Git-For-Windows within that msys2 environment, by applying this simple procedure.

After doing so, I'm getting this error when I double-click the msys2 desktop icon:

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

jdoe@msys2$

I can see where the above error originates.

The aforementioned procedure created this new script - /etc/profile.d/git-sdk.sh - which attempts to run the create-shortcut.exe command; but (like the script) I can't find where create-shortcut.exe is.

Does anyone know where that create-shortcut.exe comes from (MSYS2, MS-WINDOWS), or where it might be located? Or perhaps even know what the fix for this is? =:)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

幻想少年梦 2025-01-18 16:33:08

谢谢评论者。

这是一个错误,要么是因为引用的命令未包含在包中,要么是因为该命令不在脚本的 PATH 中。我将在 GitHub 项目中为此提交一个问题。

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

但是,如果您确实想保留该过程提供的版本 - 因为它确实提供的不仅仅是 git(1) 命令(例如,它有一个 SDK< /code> 也)——然后您可以简单地找到并安全地注释掉 /etc/profile.d/git-sdk.sh RC 脚本中的有问题的部分,该脚本的唯一目的是创建Windows 桌面图标。希望这对其他人有帮助。

Thank you to the commenters.

It's a bug, either because the referenced command wasn't included in the package, or because the command is not in the script's PATH. I'll file an issue in the GitHub project for it.

Thank you particularly to @HolyBlackCat for pointing out that the procedure wasn't necessary since git(1) is already available in MSYS2s default repositories. (I'm new to MSYS2 because I was provided a Windows environment instead of Linux). So, I ended up backing out the procedure and installing the native repository version instead, which works well.

However, if you did want to keep the version provided by the procedure -- because it does, indeed, offer more than just the git(1) command (e.g., it has an SDK too) -- then you can simply locate and safely comment-out the offending section in the /etc/profile.d/git-sdk.sh RC script, whose only purpose is to create a Windows desktop icon. Hopefully this helps others.

澜川若宁 2025-01-18 16:33:08

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

编辑 /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:$PATHcreate-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 脚本。

Actually the error will not pop up when you launch C:\git-sdk-64\git-bash.exe and it will create itself as shortcut on the desktop, that's what the lines do. You probably try to use the Windows terminal with the init command C:\git-sdk-64\usr\bin\bash.exe --login -i and the icon C:\git-sdk-64\mingw64\share\git\git-for-windows.ico.

Editing /etc/profile.d/git-sdk.sh isn't the best idea. It would've been better to adjust the user's .bash_profile to include the PATH to create-shortcut.exe, but putting export PATH="/mingw64/bin:$PATH" into the file doesn't help, because create-shortcut.exe is called even earlier.

It seems /etc/profile loads git-sdk.sh and the git-bash.exe wrapper that you skip is setting PATH="/mingw64/bin:$PATH to make create-shortcut.exe work, I think.

Luckily by the time git-sdk.sh is sourced the PATH already contains /usr/local/bin, so you can just symlink the exe to that path via an Admin shell:

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

Now the error is gone in any Terminal without touching any shell scripts.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文