Fork me on GitHub

windows10git升级

 方式一:

PS C:\WINDOWS\system32> git update
Warning! `git update` has been deprecated;
Please use `git update-git-for-windows` instead.
Git for Windows 2.24.1.windows.2 (64bit)
Update 2.25.0.windows.1 is available
Download and install Git for Windows 2.25.0 [N/y]? y
PS C:\WINDOWS\system32>

 参考

https://segmentfault.com/q/1010000011704285

https://stackoverflow.com/questions/13790592/how-to-upgrade-to-the-latest-version-of-git-on-windows-still-showing-older-vers

https://segmentfault.com/a/1190000004317077

方式二:

https://chocolatey.org/packages/git
首先安装chocolatey,操作步骤请参考https://chocolatey.org/install

  • 以管理员身份运行 CMD或者PowerShell,输入以下命令
    Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
    安装过程如下:
    PS C:\Windows\system32> Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
    Getting latest version of the Chocolatey package for download.
    Getting Chocolatey from https://chocolatey.org/api/v2/package/chocolatey/0.10.15.
    Downloading 7-Zip commandline tool prior to extraction.
    Extracting C:\Users\[UserName]\AppData\Local\Temp\chocolatey\chocInstall\chocolatey.zip to C:\Users\[UserName]\AppData\Local\Temp\chocolatey\chocInstall...
    Installing chocolatey on this machine
    Creating ChocolateyInstall as an environment variable (targeting 'Machine')
      Setting ChocolateyInstall to 'C:\ProgramData\chocolatey'
    WARNING: It's very likely you will need to close and reopen your shell
      before you can use choco.
    Restricting write permissions to Administrators
    We are setting up the Chocolatey package repository.
    The packages themselves go to 'C:\ProgramData\chocolatey\lib'
      (i.e. C:\ProgramData\chocolatey\lib\yourPackageName).
    A shim file for the command line goes to 'C:\ProgramData\chocolatey\bin'
      and points to an executable in 'C:\ProgramData\chocolatey\lib\yourPackageName'.
    
    Creating Chocolatey folders if they do not already exist.
    
    WARNING: You can safely ignore errors related to missing log files when
      upgrading from a version of Chocolatey less than 0.9.9.
      'Batch file could not be found' is also safe to ignore.
      'The system cannot find the file specified' - also safe.
    chocolatey.nupkg file not installed in lib.
     Attempting to locate it from bootstrapper.
    PATH environment variable does not have C:\ProgramData\chocolatey\bin in it. Adding...
    警告: Not setting tab completion: Profile file does not exist at
    'D:\[UserName]\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1'.
    Chocolatey (choco.exe) is now ready.
    You can call choco from anywhere, command line or powershell by typing choco.
    Run choco /? for a list of functions.
    You may need to shut down and restart powershell and/or consoles
     first prior to using choco.
    Ensuring chocolatey commands are on the path
    Ensuring chocolatey.nupkg is in the lib folder
    PS C:\Windows\system32>
  • 等待执行完成,输入choco /? 或者 choco version验证是否安装成功
    PS C:\Windows\system32> choco version
    Chocolatey v0.10.15
    
    DEPRECATION NOTICE - choco version command is deprecated and will be
     removed in version 1.0.0. Please use `choco upgrade pkgname --noop`
     instead.
    _ Chocolatey:ChocolateyVersionCommand - Noop Mode _
    chocolatey v0.10.15 is the latest version available based on your source(s).
    
    Chocolatey can upgrade 0/1 packages.
     See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).
    PS C:\Windows\system32>
  • 安装成功后,使用choco命令更新git到最新版本
    PS C:\Windows\system32> choco install -y git

总结

方式一:使用的是git-scm官方源,由于官方源文件使用的是亚马逊云的服务器,国内访问非常慢,很难更新成功,如果更新成功真的是拼网络运行商的网了,成败看人品

方式二:是换Chocolatey的安装源,不过首先要安装Chocolatey命令工具,使用choco命令来更新git到最新版本,
    windows 10 1909 (OS 内部版本 18363.836)已验证,访问速度还是挺快的,推荐

posted @ 2020-01-31 12:06  codeflyto  阅读(5166)  评论(0编辑  收藏  举报
View Code