如何将 Windows 上的 Git 升级到最新版本 [英] How to upgrade Git on Windows to the latest version

查看:123
本文介绍了如何将 Windows 上的 Git 升级到最新版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚从之前的版本 1.7.9.mysysgit.0 升级到适用于 Windows 的 Git 1.8.0.1.我从 Git 站点下载了 新版本并通过普通的 Git 安装程序 EXE 安装.

I just upgraded to Git 1.8.0.1 for Windows, from my previous version 1.7.9.mysysgit.0. I downloaded the new version from the Git site and installed through the normal Git installer EXE.

也就是说,当我打开终端窗口时,它仍然显示我正在运行 Git 版本 1.7.9.mysysgit.0.当我从提示中输入 git --version 时,同样的事情.

That said, when I fire up my terminal window, it still is showing that I am running Git version 1.7.9.mysysgit.0. When I type git --version from my prompt, the same thing.

我在类似的文章中找到了这篇文章Mac OS X 上 Git 的问题,这让我相信它与错误的 PATH 有关,但我对这一切仍然很陌生(五个月后)教),所以我不知道如何将其转换为 Windows.

I found this article on a similar issue with Git on Mac OS X, which leads me to believe that it has something to do with a faulty PATH, but I'm still pretty new at all this (five months self-taught), so I'm at a loss in how to translate this to Windows.

当我开始一个新的 Ruby on Rails 项目并试图推动它时出现了这个问题到 Git.我添加了遥控器:

This problem arose when I began a new Ruby on Rails project and tried to push it up to Git. I added the remote:

git remote add origin git@github.com:brianscottk/blog.git

然后:

git push -u origin master

我收到以下错误消息:

致命:https://github.com 引用未找到:您是否运行了 git update-server-服务器上的信息?

fatal: https://github.com refs not found: did you run git update-server-info on the server?

谷歌搜索该错误导致我这篇文章,这促使我升级,我来了.

Googling that error led me to this article, which prompted me to upgrade, and here I am.

推荐答案

从 Git 2.16.1(2) 开始你可以使用

Since Git 2.16.1(2) you can use

C:\> git update-git-for-windows

在 2.14.2 和 2.16.1 之间的版本中,命令是

In version between 2.14.2 and 2.16.1, the command was

C:\> git update

(它后来被重命名以避免与更新本地存储库混淆,例如像 svn update 那样.)

(It was later renamed to avoid confusion with updating the local repository, e.g. like svn update does it.)

该命令在 Git 2.13 及之前版本中不存在.

That command does not exist in Git 2.13 and before.

如果此错误与不是 git 命令"那么要么您实际上没有 Windows 版 Git,要么您的版本很旧.

If this errors with "is not a git command" then either you don't actually have Git for Windows, or your version is very old.

在这种情况下,只需从 https://git-scm.com/download(检查您需要 32 位还是 64 位)并运行它以升级.

In which case, simply get the latest installer from https://git-scm.com/download (check whether you want 32- or 64-bit) and run it to upgrade.

如果您已经有最新版本,它什么也不做,在这种情况下,您可以手动运行安装程序重新安装.

If you already have the latest version it does nothing, in which case you can manually run the installer to reinstall.

C:\> git update-git-for-windows
Git for Windows 2.17.0.windows.1 (64bit)
Up to date

这篇关于如何将 Windows 上的 Git 升级到最新版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆