约 800 字 预计阅读 2 分钟
Git for Windows 安装 Pacman
1. 下载必要压缩包
1
2
3
4
5
6
7
8
|
curl -o pacman-6.0.1-9-x86_64.pkg.tar.zst -L https://repo.msys2.org/msys/x86_64/pacman-6.0.1-9-x86_64.pkg.tar.zst
curl -o pacman-mirrors-20221016-1-any.pkg.tar.zst -L https://repo.msys2.org/msys/x86_64/pacman-mirrors-20221016-1-any.pkg.tar.zst
curl -o msys2-keyring-1~20221024-1-any.pkg.tar.zst -L https://repo.msys2.org/msys/x86_64/msys2-keyring-1~20221024-1-any.pkg.tar.zst
# 正常来说只需要上面三个包但是由于缺少 zstd 解压工具还需要 zstd 包
curl -o zstd-1.5.2-2-x86_64.pkg.tar.zst -L https://repo.msys2.org/msys/x86_64/zstd-1.5.2-2-x86_64.pkg.tar.zst
# 但是又因为 zstd 包也是 zstd 打包又需要另一个不是 zstd 打包的解压工具来解压
curl -o zstd-v1.5.2-win64.zip -L https://github.com/facebook/zstd/releases/download/v1.5.2/zstd-v1.5.2-win64.zip
|
2 .解压并安装:
1
2
3
4
5
6
|
unzip zstd-v1.5.2-win64.zip "zstd-v1.5.2-win64/zstd.exe" -d .
./zstd-v1.5.2-win64/zstd.exe -d -o zstd-1.5.2-2-x86_64.pkg.tar zstd-1.5.2-2-x86_64.pkg.tar.zst
tar -xvf zstd-1.5.2-2-x86_64.pkg.tar -C /
tar -xvf msys2-keyring-1~20221024-1-any.pkg.tar.zst -C /
tar -xvf pacman-mirrors-20221016-1-any.pkg.tar.zst -C /
tar -xvf pacman-6.0.1-9-x86_64.pkg.tar.zst -C /
|
3. 添加密钥并更新数据库:
1
2
3
4
5
|
pacman-key --init && pacman-key --populate msys2
pacman-db-upgrade -r /../
pacman -Sy
|
4. 更新元数据:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
# pacman -S pacman-mirrors-20221016-1 msys2-keyring-1~20221024-1 zstd-1.5.2-2
# pacman -S $(cut -d ' ' -f 1 /etc/package-versions.txt)
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
for f in desc files install mtree; do
echo "$URL$d/$f" ..... $d/$f
curl -sSL "$URL$d/$f" -o $d/$f
done
done
curl -sSL https://github.com/git-for-windows/git-sdk-64/raw/main/pacman-6.0.1-9/desc -o /var/lib/pacman/local/pacman-6.0.1-9/desc
curl -sSL https://github.com/git-for-windows/git-sdk-64/raw/main/pacman-6.0.1-9/files -o /var/lib/pacman/local/pacman-6.0.1-9/files
curl -sSL https://github.com/git-for-windows/git-sdk-64/raw/main/pacman-6.0.1-9/install -o /var/lib/pacman/local/pacman-6.0.1-9/install
curl -sSL https://github.com/git-for-windows/git-sdk-64/raw/main/pacman-6.0.1-9/mtree -o /var/lib/pacman/local/pacman-6.0.1-9/mtree
curl -sSL https://github.com/git-for-windows/git-sdk-64/raw/main/pacman-mirrors-20221016-1/desc -o /var/lib/pacman/local/pacman-mirrors-20221016-1/desc
curl -sSL https://github.com/git-for-windows/git-sdk-64/raw/main/pacman-mirrors-20221016-1/files -o /var/lib/pacman/local/pacman-mirrors-20221016-1/files
curl -sSL https://github.com/git-for-windows/git-sdk-64/raw/main/pacman-mirrors-20221016-1/install -o /var/lib/pacman/local/pacman-mirrors-20221016-1/install
curl -sSL https://github.com/git-for-windows/git-sdk-64/raw/main/pacman-mirrors-20221016-1/mtree -o /var/lib/pacman/local/pacman-mirrors-20221016-1/mtree
curl -sSL https://github.com/git-for-windows/git-sdk-64/raw/main/msys2-keyring-1~20221024-1/desc -o /var/lib/pacman/local/msys2-keyring-1~20221024-1/desc
curl -sSL https://github.com/git-for-windows/git-sdk-64/raw/main/msys2-keyring-1~20221024-1/files -o /var/lib/pacman/local/msys2-keyring-1~20221024-1/files
curl -sSL https://github.com/git-for-windows/git-sdk-64/raw/main/msys2-keyring-1~20221024-1/install -o /var/lib/pacman/local/msys2-keyring-1~20221024-1/install
curl -sSL https://github.com/git-for-windows/git-sdk-64/raw/main/msys2-keyring-1~20221024-1/mtree -o /var/lib/pacman/local/msys2-keyring-1~20221024-1/mtree
curl -sSL https://github.com/git-for-windows/git-sdk-64/raw/main/zstd-1.5.2-2/desc -o /var/lib/pacman/local/zstd-1.5.2-2/desc
curl -sSL https://github.com/git-for-windows/git-sdk-64/raw/main/zstd-1.5.2-2/files -o /var/lib/pacman/local/zstd-1.5.2-2/files
curl -sSL https://github.com/git-for-windows/git-sdk-64/raw/main/zstd-1.5.2-2/install -o /var/lib/pacman/local/zstd-1.5.2-2/install
curl -sSL https://github.com/git-for-windows/git-sdk-64/raw/main/zstd-1.5.2-2/mtree -o /var/lib/pacman/local/zstd-1.5.2-2/mtree
|
5. 安装Fish Shell
5.1 安装必要依赖
5.2 安装Fish Shell并启动
5.3 启动Fish Shell
1
2
3
4
|
# 在~/.bashrc文件中添加以下内容,设置默认shell为fish
if [ -t 1 ]; then
exec fish
fi
|
5.4 更换Fish Shell 主题
5. 5 Fish Shell 常用命令和基本设置
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
# 关闭问候语
set -g -x fish_greeting ''
set -U fish_greeting
# 设置环境变量
#在最后一行加入(注意目录间用空格隔开)
set -x PATH /opt/demo/bin /home/guest/bin $PATH
# 删除变量
set -e Foo
# 配置别名
# Define alias in config file
alias rmi="rm -i"
# 切换默认shell,git for windows下不可用
echo $SHELL
cat /etc/shells
chsh -s /usr/bin/fish
# 命令替换
echo (date)
# 在bash下面
# echo `date`
|
参考资料: