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

查看:604
本文介绍了如何在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, same thing.

我发现与本文类似的文章Mac OSX上Git的问题,这使我相信它与错误的PATH有关,但是我仍然很新(自学5个月),所以我在将其翻译为Windows的方法有所损失.

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

当我开始一个新的Rails项目并尝试将其推向Git时,出现了这个问题.我添加了遥控器:

This problem arose when I began a new 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天全站免登陆