git@git安装包下载@国内git for windows加速下载@命令行一键安装git软件@多种加速下载方案高成功率.md

abstract

  • git是一个基础软件,应用十分广泛,但是它的官网下载速度却让国内用户感到不快
  • git for windows 是一个git在windows平台的客户端,除了官网下载,本文列举了多种可以提高下载速度的方案,可靠性由高到低,成功率几乎百分之百

镜像下载

可以下载到较新版本,并且速度较快

从github release配合github加速站下载

从应用商店下载

  • 比如国内的联想应用商店,火绒应用商店
  • 这些商店下载到的版本数量有限,而且往往不是最新版本,但是下载成功率高,并且git这类软件可以几年更新一次也不太影响使用

使用包管理工具下载

  • windows上也是有包管理工具
    • scoop :国内许多爱好者为其制作了加速镜像和临时bucket,以提供scoop部署,并且带有git软件
    • x-cmd:Windows | x-cmd get-started 为用户提供的bat脚本包含了git安装服务(调用系统自带的C:\Windows\System32\curl.exe 在命令行中下载所需文件)

使用代理服务器下载

  • 代理服务器是比较通用的加速服务资源,不用多说
  • 有些站点提供国外资源加速下载的服务,不过速度上限一般不会太快

一键安装(便携版Git)

借助于以下开源项目来一键安装Git(安装的是便携版)

方案1

执行记录(参考)
PS C:\Users\cxxu>         Set-ExecutionPolicy RemoteSigned -Scope CurrentUser -Force
PS C:\Users\cxxu>
PS C:\Users\cxxu>         Invoke-WebRequest -useb scoop.201704.xyz | Invoke-Expression
Initializing...
Downloading...
Extracting...
Creating shim...
Scoop was installed successfully!
Type 'scoop help' for instructions.
PS C:\Users\cxxu>
PS C:\Users\cxxu>         scoop install git  #为当前用户安装,如果全局需要管理员权限
Installing '7zip' (24.07) [64bit] from 'main' bucket
proxy: https://www.7-zip.org/a/7z2407-x64.msi
7z2407-x64.msi (1.9 MB) [=====================================================================================] 100%
Checking hash of 7z2407-x64.msi ... ok.
Extracting 7z2407-x64.msi ... done.
Linking ~\scoop\apps\7zip\current => ~\scoop\apps\7zip\24.07
Creating shim for '7z'.
Creating shim for '7zFM'.
Making C:\Users\cxxu\scoop\shims\7zfm.exe a GUI binary.
Creating shim for '7zG'.
Making C:\Users\cxxu\scoop\shims\7zg.exe a GUI binary.
Creating shortcut for 7-Zip (7zFM.exe)
Persisting Codecs
Persisting Formats
Running post_install script...done.
'7zip' (24.07) was installed successfully!
Notes
-----
Add 7-Zip as a context menu option by running: "C:\Users\cxxu\scoop\apps\7zip\current\install-context.reg"
Installing 'git' (2.45.2) [64bit] from 'main' bucket
proxy: https://github.com/git-for-windows/git/releases/download/v2.45.2.windows.1/PortableGit-2.45.2-64-bit.7z.exe
PortableGit-2.45.2-64-bit.7z.exe (60.1 MB) [==================================================================] 100%
Checking hash of PortableGit-2.45.2-64-bit.7z.exe ... ok.
Extracting PortableGit-2.45.2-64-bit.7z.exe ... done.
Linking ~\scoop\apps\git\current => ~\scoop\apps\git\2.45.2
Creating shim for 'sh'.
Creating shim for 'bash'.
Creating shim for 'git'.
Creating shim for 'gitk'.
Making C:\Users\cxxu\scoop\shims\gitk.exe a GUI binary.
Creating shim for 'git-gui'.
Making C:\Users\cxxu\scoop\shims\git-gui.exe a GUI binary.
Creating shim for 'scalar'.
Creating shim for 'tig'.
Creating shim for 'git-bash'.
Making C:\Users\cxxu\scoop\shims\git-bash.exe a GUI binary.
Creating shortcut for Git Bash (git-bash.exe)
Creating shortcut for Git GUI (git-gui.exe)
Running post_install script...done.
'git' (2.45.2) was installed successfully!
Notes
-----
Set Git Credential Manager Core by running: "git config --global credential.helper manager"

To add context menu entries, run 'C:\Users\cxxu\scoop\apps\git\current\install-context.reg'

To create file-associations for .git* and .sh files, run
'C:\Users\cxxu\scoop\apps\git\current\install-file-associations.reg'

方案2

$url = 'https://gitee.com/xuchaoxin1375/scripts/raw/main/PS/Deploy/Deploy-CxxuPsModules.ps1'
$scripts = Invoke-RestMethod $url
$scripts | Invoke-Expression
# Deploy-CxxuPsModules 
Deploy-GitForwindows #安装git for windows

  • 不保证一次成功,合并了方案1

其他方案

  • 这些方案不推荐

国内代码托管平台

云盘分享

  • 部分平台或公众号或论坛有人分享软件的安装包,有些不限速的链接可以用
  • 安全性欠缺
posted @ 2024-09-25 17:08  xuchaoxin1375  阅读(173)  评论(0)    收藏  举报  来源