How to upgrade Git on Windows to the latest version?
I just upgraded to Git 18.104.22.168 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, same thing.
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.
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 [email protected]:brianscottk/blog.git
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.
Since Git 2.16.1(2) you can use
C:\> git update-git-for-windows
In versions 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
Read more... Read less...
First, check your git version by using this command
Then follow the case according to your git version
If your git version is 2.14.1 or earlier:
Uninstall the git, download the latest git, and install it again.
And versions between 2.14.2 and 2.16.1:
If the version is equal to or greater than Git 2.16.1(2):
Update (26SEP2016): It is no longer needed to uninstall your previous version of git to upgraded it to the latest; the installer package found at git win download site takes care of all. Just follow the prompts. For additional information follow instructions at installing and upgrading git.
Just give the following command with your command prompt.
This will ask you a confirmation as follows. Press Y to proceed.
Once the files are dowloaded, Continue with normal installation procedures. You can check the git version after finishing installation with the following command
For me, the result was as follows.
Note, if you are instead looking to find out what version of
Git Bash you are running, or want to see if you need to update
Git Bash, it is part of
Git for Windows.
So your Git Bash version is:
git version 2.23.0.windows.1
Note that it is technically different from
Bash. On my same machine when I run:
Git for Windows installer
To update to the latest version of Git and Git Bash, you can download and install the latest version of git for Windows. As per FAQ, settings/customizations should be preserved if they were installed in the appropriate configuration folders.
Note: Their installer is actually intelligently designed to do the right thing (except for telling you that it's doing the right thing automatically). If you are doing an update, then every screen on the installer is pre-marked with the settings from your current (soon to be previous) install.
It is not showing you generic default settings. You do not need to look any of them up, or fear for breaking your carefully honed setup. Just leave everything as is, to retain your previous choices.
In fact, they made it even easier (if only it was clear that they did so).
There is a checkbox at the bottom
 Show only new settings (I don't remember the exact wording). Since nothing on the first screen changes when you mark the box, it is not exactly obvious what it is for. If you mark the box, then all of your current settings will be retained, and it will skip showing those subsequent settings screens to you. Only screens with newly introduced settings will be shown.
Alternatively, as others have noted, you can also update Git Bash and Git (by definition, both are always updated at the same time) from the Git Bash command line, via:
If you type
git update, git kindly reminds you that the command has been updated to
git updatehas been deprecated;
Git for Windows 2.26.0.windows.1 (64bit)
Up to date
Using the command "where git" find out how command prompt picks up the version. Once you have the path, you can go ahead and uninstall / delete previous version completely. Then if you install and make sure the new installed location is in the path, it should just work fine.
Using git-friendly tools like cmder will make your life much easier. You don't really have to use dual boot or cygwin anymore since the support for git in windows is already top-notch now. (Git for windows installs msysgit which includes all necessary unix tools from MinGW. MinGW has been there for a while and is pretty stable. If you want you can install the full version of msysgit rather than Git for Windows. msysgit is available on Git for windows page at the bottom.)