car*_*mer 36 windows git bash msys msysgit
我在github上阅读wiki for git,它说msys2捆绑了pacman:https://github.com/git-for-windows/git/wiki/Package-management
但是当我调用它时:
$ pacman
bash: pacman: command not found
Run Code Online (Sandbox Code Playgroud)
有谁知道发生了什么?这个wiki指的是哪个git版本?有没有办法在Git for windows中为msys2安装额外的软件包?
Von*_*onC 29
如问题397所述:
这是有意的.我们不用Git for Windows发送pacman.
如果您对完全成熟的软件包管理器维护环境感兴趣,那么您必须尝试使用Git for Windows SDK.
你在最新的git for Windows(2.5.3)中看到的bash ,它是一个比旧的msysgit更新的bash,只是执行git命令.
安装任何第三方软件包并不是一个成熟的Linux环境.
N. *_*Ngo 14
Git for Windows(https://gitforwindows.org/或https://git-scm.com/downloads)(有Git Bash),但不包括tree
.tree
可用于via pacman
(程序包管理器),但仅当您安装"Git for Windows SDK " 时才可用(滚动到https://gitforwindows.org/的底部,它提供了从https://下载安装程序的链接)github.com/git-for-windows/build-extra/releases/latest)
这个SO:"用于Windows的git中的包管理?" 非常有帮助 在Windows的git中进行包管理?
同样如上面的SO所述,他们链接到这个git for windows issue [Pacman缺少新的2.5.2安装#397],它打算不包含pacman
在默认安装中.
无论如何,我安装了"Git for Windows SDK",然后在它的bash提示符(SDK-64)中运行以下命令安装当前树v1.7.0-1(截至2018年8月30日):
[SDK-64: Bash Terminal for Git for Windows SDK]
pacman -S tree
...
Proceed with installation? [Y/n] Y
Run Code Online (Sandbox Code Playgroud)
在我的系统上,Git for Windows SDK安装在:C:\git-sdk-64
,所以从我的Git for Windows Bash shell(没有安装树),我将它复制到tree.exe到它的/ usr/bin目录,例如
[MINGW64: Bash Terminal for Git for Windows]
cd /usr/bin
cp /c/git-sdk-64/usr/bin/tree.exe .
Run Code Online (Sandbox Code Playgroud)
现在我可以tree
从两个Git Bash shell 运行v1.7.0.
因此,为了让其他人,也许我自己在未来的机器上更容易,我通过在我的Git for Windows SDK Bash终端中运行以下来查看从哪里pacman
获取tree
包:
$ pacman -S --info tree
Repository : msys
Name : tree
Version : 1.7.0-1
Description : A directory listing program displaying a depth indented list of files
Architecture : x86_64
...
Run Code Online (Sandbox Code Playgroud)
关键是,这是pacman
从"msys"存储库中获取它(仅供参考:即使它说的是msys,它确实使用的是msys2),所以我看着/etc/pacman.d/mirrorlist.msys
第一个镜像指向http://repo.msys2.org/msys/$arch/
因此,下次您需要一个不在 Git for Windows中的软件包时,可以从http://repo.msys2.org/msys/x86_64/(64位)或http://repo.msys2下载它们..org/msys/i686 /(32位)
例如,树v1.7.0-1的直接下载链接
仅供参考:Git SCM的Window下载地址为https://git-scm.com/download/,从Git for Windows GitHub获取最新信息(https://github.com/git-for-windows/git来自https:// github .com/git-for-windows/git/releases / link)
小智 14
我不想从我已经在工作的 Git for Windows 安装中移动,所以我即兴创作了一点:
${git-sdk}/usr/bin/pacman.exe
到${git}/usr/bin
${git-sdk}/etc/pacman.conf
和${git-sdk}/etc/pacman.d
到${git}/etc
${git-sdk}/var
到${git}/
就这样。您现在可以打开 Git Bash 并运行pacman -S python
以在现有 Git for Windows 设置上安装软件包。
您将需要对 Git for Windows 目录的写访问权限。此外,您pacman
现在认为它安装了很多软件包(来自 SDK),但这并没有阻止我使用它。
Mik*_*ton 11
似乎有一种文档化的方法可以做到这一点,而无需安装 Git for Windows SDK(非常大)。当我在 GitHub issue #1912上询问所有这些时,PhilipOakley 给了我这个信息的链接。
这是 Git for Windows GitHub wiki 页面的当前文本:
正确安装在 MSYS2 内部
请注意,Git for Windows 不正式支持此方案
(这是不受支持的原因是没有志愿者来支持这种情况。)
本指南假定您需要适用于 Windows 的 64 位 Git 版本。
Git for Windows 基于 MSYS2,可以将
git
包安装到现有的 MSYS2 安装中。这意味着如果你已经在你的计算机上使用 MSYS2,你可以在不运行完整安装程序或使用便携式版本的情况下使用 Git for Windows。但是请注意,这样做有一些注意事项。Git for Windows 创建了一些
msys2-runtime
尚未发送到上游的补丁。(这是计划好的,但在问题#284 中确定它可能不会发生。)这意味着您必须安装适用于 Windows 的 Git 定制,msys2-runtime
以便在 MSYS2 中拥有一个完全工作的 git。这里要采取的步骤:
打开 MSYS2 终端。
编辑
/etc/pacman.conf
之前[mingw32]
(我机器上的第 71 行),添加git-for-windows
包存储库:
[git-for-windows] Server = https://wingit.blob.core.windows.net/x86-64
以及可选的相反架构的 MINGW -only 存储库(即 MINGW32 用于 64 位 SDK):
[git-for-windows-mingw32] Server = https://wingit.blob.core.windows.net/i686
- 授权签名密钥(此步骤可能需要偶尔重复,直到https://github.com/msys2/msys2/issues/62被修复)
curl -L https://raw.githubusercontent.com/git-for-windows/build-extra/master/git-for-windows-keyring/git-for-windows.gpg | pacman-key --add - && pacman-key --lsign-key 1A9F3986
- 然后同步新的存储库
pacboy update
这会更新
msys2-runtime
,因此会要求您关闭窗口(而不仅仅是退出 pacman 进程)。不要惊慌,只需关闭所有当前打开的 MSYS2 shell 和 MSYS2 程序。仔细检查任务管理器并pacman.exe
在窗口关闭后杀死它仍在运行,因为它可以逗留。全部关闭后,再次启动新终端。然后再次同步(更新包的非核心部分):
pacboy update
- 最后安装 Git/cURL 包:
pacboy sync git:x git-doc-html:x git-doc-man:x git-extra: curl:x
- 最后,通过
git --version
在 MINGW64 shell 中执行检查是否一切正常,它应该输出类似git version 2.14.1.windows.1
(或更新)的内容。
Mic*_*hen 10
"Git for Windows SDK" is 5.33GB compared to "Git for Windows" 691MB compared to "Portable Git" 275MB. I use the lean and mean Portable Git. At first, it seems hopeless trying to restore and use pacman in the latter two flavors of Git (msys2), because Google excluded ALL metadata files in /var/lib/pacman/local. Please read this official explanation:
Without those metadata files, you don't know the exact collection and version of the msys2 packages Google selected to build a release of those 2 flavors of Git. If you force to install or copy the current version of msys2 packages, you run the risk of version mismatch with git binaries Google built and tested.
Well, that's until I discover this file: /etc/package-versions.txt, the laundry list of matching msys2 packages and versions. Now there is a definitive source in github. Here is how I restore pacman in Portable Git:
Step 1: Run these commands to download /etc/pacman.conf and 3 packages: pacman, pacman-mirrors and msys2-keyring. These are .xz packages before msys2 switched to zstd. See my comment below.
curl https://raw.githubusercontent.com/msys2/MSYS2-packages/7858ee9c236402adf569ac7cff6beb1f883ab67c/pacman/pacman.conf -o /etc/pacman.conf
for f in pacman-5.2.2-4-x86_64 pacman-mirrors-20201028-1-any msys2-keyring-1~20201002-1-any;
do curl https://repo.msys2.org/msys/x86_64/$f.pkg.tar.xz -o ~/Downloads/$f.pkg.tar.xz;
done
Run Code Online (Sandbox Code Playgroud)
Step 2: Unpack them at the root then restore pacman with these commands:
cd /
tar x --xz -vf ~/Downloads/msys2-keyring-1~20201002-1-any.pkg.tar.xz usr
tar x --xz -vf ~/Downloads/pacman-mirrors-20201028-1-any.pkg.tar.xz etc
tar x --xz -vf ~/Downloads/pacman-5.2.2-4-x86_64.pkg.tar.xz usr
mkdir -p /var/lib/pacman
pacman-key --init
pacman-key --populate msys2
pacman -Syu
Run Code Online (Sandbox Code Playgroud)
Step 3: The next two commands restore all matching metadata. The second command is multi-line but still safe to cut and paste (be patient):
URL=https://github.com/git-for-windows/git-sdk-64/raw/main
cat /etc/package-versions.txt | while read p v; do d=/var/lib/pacman/local/$p-$v;
mkdir -p $d; echo $d; for f in desc files install mtree; do curl -sSL "$URL$d/$f" -o $d/$f;
done; done
Run Code Online (Sandbox Code Playgroud)
Step 4: Now, is it too much to ask for 'make' and 'zip'?
pacman -S make zip
Run Code Online (Sandbox Code Playgroud)
Voilà, still just a 337MB mean little environment that can expand and upgrade!
msys2
(版本20190524已测试。)或Git for Windows SDK
. (尚未完全测试,但应该可以工作。)两者都包括 PacMan 和 Git。msys64\usr\bin\
指向C:\Program Files\Git\bin\git.exe
. 在 cmd.exe 中执行以下命令,而不是在 bash 中。mklink git "C:\Program Files\Git\bin\git.exe"
gvfs clone https://dev.azure.com/somebody/_git/somerepo
。只有gvfs命令不能在msys2上执行。推荐使用Virtual Filesystem for Git(以前是 GVFS,官网https://vfsforgit.org/ )。版本 2.22 和 2.26 已测试。不推荐使用Scalar(官方网站https://github.com/microsoft/scalar),也没有经过全面测试。
GVFS
并Git for Windows with GVFS patch
。或者安装 Scalar for Git
并 Git for Windows with Scalar patch
. 不能两者都在同一台机器上。默认安装目标是C:\Program Files\Git
.C:\Program Files\Git
. 默认情况下,它位于C:\msys64
./etc/pacman.d
和复制/etc/pacman.conf
到 Git 安装文件夹,覆盖现有文件。它将 msys2 和 MinGW 运行时更新到最新版本。对于 PacMan,必要的文件是/usr/bin/pac* ; /etc/pacman.conf ; /etc/pacman.d/ ; /var ; /usr/bin/msys* ;
。(未完全测试。)C:\Program Files\Git\bin\bash.exe
将启动 Windows 版 Git 的 bash。运行C:\Program Files\Git\usr\bin\bash.exe
将启动 msys2 的 bash。配置终端程序(例如超级终端)的bash路径。由于 Git 位于系统文件夹中,因此终端程序应以管理员身份运行。export PATH=$PATH:/C/Program\ Files/GVFS
或者export PATH=$PATH:"/C/Program Files/GVFS"
。或者在控制面板的系统属性中设置GVFS的环境变量。重新登录即可生效。有时此配置不起作用,但 PacMan 仍然可以运行。chmod +x /usr/bin/pacman ; pacman-key --init ; pacman-key --populate msys2 ; pacman-key --refresh-keys ; pacman --sync pacman --refresh --sysupgrade --sysupgrade --overwrite "*"
。使用该选项 --overwrite \*
是因为某些软件包是由 Windows 版 Git 安装的,而不是 PacMan。 归档时间: |
|
查看次数: |
30585 次 |
最近记录: |