Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to upgrade Git on Windows to the latest version

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.

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.

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.

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 [email protected]:brianscottk/blog.git 

then:

git push -u origin master 

I received the following error message:

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.

like image 400
BrianScottK Avatar asked Dec 09 '12 18:12

BrianScottK


People also ask

How do I update to the latest version of Git?

Download the installation file from the Git website. Run the installation and follow the install wizard to update Git to the latest version. Note: Using the install wizard to update Git overwrites the current installation.


2 Answers

First, check your Git version by using this command

git version 

Then follow the case according to your Git version

Three cases:

  1. If your Git version is 2.14.1 or earlier:

    Uninstall Git, download the latest Git, and install it again.

  2. And versions between 2.14.2 and 2.16.1:

    Use command git update

  3. If the version is equal to or greater than Git 2.16.1(2):

    Use command git update-git-for-windows

like image 40
Arslan Ahmad khan Avatar answered Sep 21 '22 13:09

Arslan Ahmad khan


Since Git 2.16.1(2) you can use

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

In version between 2.14.2 and 2.16.1, the command was

C:\> git update 

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

That command does not exist in Git 2.13 and before.

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.

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 
like image 97
Dutch Glory Avatar answered Sep 23 '22 13:09

Dutch Glory