git无法下载tools/scripts/git-bash.sh所指向的文件
首先开启管理员权限,最简单的方法有三种(任选其一):
- 开始菜单
- 在开始菜单里搜 Git Bash(或 Git CMD、Git GUI)。
- 右键 → 以管理员身份运行(Run as administrator)。
- 弹出 UAC 点“是”。
- 资源管理器
- 到安装目录:
C:\Program Files\Git\git-bash.exe - 右键 git-bash.exe → 以管理员身份运行。
- 用 PowerShell/命令行提升启动
在任意终端里执行(会弹出 UAC):
Start-Process "C:\Program Files\Git\git-bash.exe" -Verb RunAs
(或)
powershell -Command "Start-Process 'C:\Program Files\Git\git-bash.exe' -Verb RunAs"
如何确认已经是管理员窗口
在 Git Bash 中执行任一条:
whoami /groups | grep -Ei "Administrators|S-1-5-32-544" && echo "管理员权限" || echo "非管理员"
# 或
net session >/dev/null 2>&1 && echo "管理员权限" || echo "非管理员"
提醒:Git 本身没有“管理员模式”,关键在于以管理员权限启动的 Shell 窗口。平时不需要一直用管理员,只在需要(比如 ADI 的
tools/scripts/git-bash.sh第一次初始化)时开一次即可。
假设这台机启用了系统代理(127.0.0.1:7897)。浏览器会走代理,但 Git Bash 里的 curl / git 默认不会跟随系统代理,需要单独配置。VPN需要开全局模式。按下面做,一步到位:
1) 在 Git Bash 里设置(当前会话马上生效)
# 你的 HTTP/HTTPS 代理(按截图:127.0.0.1:7897)
export http_proxy="http://127.0.0.1:7897"
export https_proxy="$http_proxy"
# 可选:如果你的客户端还提供 SOCKS5 端口(如 7891),再加一条
# export all_proxy="socks5h://127.0.0.1:7891"
# 不走代理的网段(结合你窗口里的“绕过本地地址”)
export no_proxy="localhost,127.0.0.1,::1,*.local,10.0.0.0/8,172.16.0.0/12,192.168.0.0/16"
立刻验证是否在走代理:
env | grep -i _proxy
curl -4 --http1.1 https://ifconfig.me -v 2>&1 | grep -E "Connected to|< HTTP"
正常会看到 Connected to 127.0.0.1 port 7897。
2) 让设置长期生效(每次打开 Git Bash 自动加载)
之前你把
~/.profile建成目录导致脚本报错,先确认它是文件:
# 如果 .profile 是目录,先改名再重建空文件
[ -d ~/.profile ] && mv ~/.profile ~/.profile_dir_backup
: > ~/.profile
# 把代理写进 ~/.profile
cat >> ~/.profile <<'EOF'
export http_proxy="http://127.0.0.1:7897"
export https_proxy="$http_proxy"
# export all_proxy="socks5h://127.0.0.1:7891"
export no_proxy="localhost,127.0.0.1,::1,*.local,10.0.0.0/8,172.16.0.0/12,192.168.0.0/16"
EOF
关闭当前 Git Bash,重新打开一个窗口,
env | grep -i _proxy检查已加载。
3) 给 git 也配上代理(不然 git clone/submodule 仍会超时)
git config --global http.proxy "http://127.0.0.1:7897"
git config --global https.proxy "http://127.0.0.1:7897"
# 稳定性增强(很多公司网络/中间盒对 HTTP/2 不友好)
git config --global http.version HTTP/1.1
git config --global http.sslBackend openssl
4) 测试下载 SourceForge(用“文件 + 固定镜像”)
不要对目录发请求,直接对具体文件,并固定一个好用镜像,例如 pilotfiber/versaweb/phoenixnap:
curl -4 --http1.1 -fL --retry 5 --retry-all-errors \
"https://downloads.sourceforge.net/project/ezwinports/make-4.4.1-without-guile-w32-bin.zip?use_mirror=pilotfiber" \
-o /tmp/make.zip
成功后解压:
unzip -j -o /tmp/make.zip -d /tmp/make_extracted 2>/dev/null || { mkdir -p /tmp/make_extracted; tar -xf /tmp/make.zip -C /tmp/make_extracted; }
cp -f /tmp/make_extracted/bin/make.exe /mingw64/bin/ 2>/dev/null || cp -f /tmp/make_extracted/make.exe /mingw64/bin/
make --version
5)(可选)把 Windows“系统代理”同步到 WinHTTP 栈
某些命令行程序走 WinHTTP,需要导入一次(管理员 PowerShell):
netsh winhttp import proxy source=ie
netsh winhttp show proxy
6) 常见坑位
-
代理端口要确认是 HTTP/HTTPS 端口(很多客户端:HTTP 7890/7897,SOCKS5 7891)。若只有一个端口,就按上面 http(s)_proxy 配就行。
-
不要把
_proxy变量设成空字符串;直连时请unset http_proxy https_proxy all_proxy no_proxy。 -
仍有 TLS 报错时,优先加
-4 --http1.1;或改用 PowerShell:Invoke-WebRequest "https://downloads.sourceforge.net/project/ezwinports/make-4.4.1-without-guile-w32-bin.zip?use_mirror=pilotfiber" -OutFile "$env:TEMP\make.zip"
照以上 1→4 步做完,你的 curl/git 在 Git Bash 里就能和浏览器一样走 VPN 代理,SourceForge 的下载也能稳定跑通。
Open up a Git Bash as Administrator once and run the script. Close the window. You only need to do this once per Git Bash installation. tools/scripts/git-bash.sh
退出管理员权限
开启开发者模式
假设 Vitis 2022.2 安装在以下路径:
C:\Xilinx
├── DocNav
├── Downloads
└── Vitis
└── 2022.2
在无作系统根目录中,运行:
$ source tools/scripts/git-bash-paths.sh /c/Xilinx/Vitis/2022.2/settings64.sh
或者,仅使用所需的路径:
$ export PATH=/c/Xilinx/Vitis/2022.2/bin:/c/Xilinx/Vitis/2022.2/gnu/aarch64/nt/aarch64-none/bin/:$PATH
将 .xsa 复制到项目文件夹并运行:
./no-OS/projects/adrv9009
├── Makefile
├── profiles
├── src
├── src.mk
└── system_top.xsa
$ make
更多推荐
所有评论(0)