How to update git version from GitHub Desktop on Windows
Asked Answered
J

4

5

I want to use the new worktree functionality introduced in git 2.5. However, I don't know how to update to the most recent version of GitHub Desktop (not git itself).

I install GitHub for desktop and hoped it ships with the most recent version, however git --version returns git version 1.9.5.github.0. But if I understand correctly, we're already at version 2.6.x! So how can I update to this version on my Windows machine, where the only version of git I installed was with the GH Desktop?

Joinery answered 10/11, 2015 at 18:3 Comment(1)
I have edited my answer to add a caveat about git system settings.Bellanca
B
2

Update Nov. 25th, 2015.
For what it is worth, GitHub Desktop (finally) uses a more recent git version: 2.5. See Brendan Foster tweet.


Original answer (early Nov 2015)

First, the latest git for windows release is available here on GitHub.
I always use the archive portable form (unzipped anywhere I want, and added to the PATH).

But if you have chosen the exe setup, that means it has been installed in C:\Program Files\Git.

However, as I mentioned here, git is also included in GitHub Desktop own installation path (%USERPROFILE%\AppData\Local\GitHub\PORTAB~1\bin)

You could, in theory, replace the exact value of the folder PORTAB~1 by a directory JUNCTION:

cd %USERPROFILE%\AppData\Local\GitHub
dir # take note of the exact name of PORTABLEGIT folder: <PORTAB...>
move <PORTAB...> old_PORTABLEGIT
mklink /J <PORTAB...> "C:\Program Files\Git"

In my latest GitHub Desktop 3.0.7.1 3397ae4, I see:

C:\Users\vonc\AppData\Local\GitHub\PortableGit_c2ba306e536fdf878271f7fe636a147ff37326ad\bin

However, that would not work: when starting GitHub Desktop again, it would detect the change and restore its own embedded Git version (1.9.5)

So you can't force easily GitHub Desktop to use another git version.


Even if you were able somehow to force GitHub for Desktop to use another version of Git, you would have to carefully report its own internal git system configuration:

 C:\Users\vonc\AppData\Local\GitHub\PortableGit_c2b...\etc\gitconfig

This file points to GitHub Desktop specific settings:

[http]
        sslcainfo = /bin/curl-ca-bundle-ghfw.crt
[credential]
        helper = !github --credentials

[filter "ghcleansmudge"]
        clean = cat
        smudge = cat

THose settings are not present in a non-GitHub embedded version of Git, and would need to be restored.

Bellanca answered 14/11, 2015 at 0:15 Comment(10)
So, in conclusion: So you can't force easily GitHub Desktop to use another git version.?Joinery
@BramVanroy Exactly. You can confirm with GitHub support, but the way I see their product, they worked really hard to keep their own git version, and prevent any "tinkering".Bellanca
Not that I put a lot of effort in trying to contact them, but I didn't get an answer on a tweet I sent them unfortunately. Thanks for figuring things out!Joinery
@BramVanroy By the way, GitHub Desktop now uses git 2.5! See my updated answer.Bellanca
O yes! Thanks a lot! Gonna try it out, and how that worktree functionality is "allowed"Joinery
This is a problem with security updates of Git. It's too bad that GitHub is tied so tightly. Today, my Secunia PSI warned me of minor vulnerabilities in 2.11.0 (which is probably the "A potential but unlikely buffer overflow in Windows port has been fixed." in 2.11.1. I now have to wait for GitHub folks to integrate that fix. Lately, I've been using Source Tree (Atlassian) more and more for this and many other reasons.Recant
@Recant I agree. I always use the "System" Git in Source Tree, ie the one I can point to (which is the latest one at github.com/git-for-windows/git/releases)Bellanca
It's happened again. I'm surprised GitHub is using a version of GIT that ends in .0 -- see screen shot here: imgur.com/SZRDZrzRecant
@Recant Is that the embedded Git packaged with GitHub Desktop?Bellanca
@Bellanca yes, in `AppData\Local\GitHub`Recant
R
1

You can find the Windows Git installer here: http://www.git-scm.com/

For best results, I suggest uninstalling Github desktop, installing Git (which you downloaded from the above link), and reinstalling the Github client.

Railing answered 10/11, 2015 at 18:11 Comment(1)
Hm, unfortunately this doesn't work. I did as you said, and the git version used by GitHub Desktop is still the 1.9.5 version. Git has been installed, though, because when I run git --version in the newly installed git folder from the bash command, it returns 2.6.3.Joinery
T
0

If you want to use worktree why don't you install MSYS2 ?

MSYS2 is a fork of mSysGit which is not maintained anymore

It's like a unix console and you can update your own git version thanks to Pacman which is a package manager from Archlinux

I hope you'll find this helpful !

Regards

EDIT : If you only want to use "Git For Windows", here is the last release which comes with Git v2.6.3.

Transept answered 17/11, 2015 at 10:11 Comment(3)
I could simply use the git shell to use the latest git version, the problem is that I want to use the most recent version INSIDE GITHUB DESKTOP.Joinery
So here is what you need : Git 2.6.3Transept
Not Git for windows. Github for Desktop.Joinery
G
-1

The instructions describing the steps required to update github for windows are listed here:

  1. In the upper-right corner of the Github for Windows, click the icon that looks like a little gear or cog (see image example).

  2. Choose About GitHub Desktop from the menu initiated when you clicked the icon in step 1.

  3. If an update is available, you will be permitted to click Restart to install update.

  4. here is the link to all the steps screen grabbed off the app on imgur

Gooch answered 14/11, 2015 at 4:38 Comment(1)
That's not the question. I need to use an updated version of git inside the appJoinery

© 2022 - 2024 — McMap. All rights reserved.