How to upgrade Git on windows? - windows

I'm currently running git version 1.8.0-preview20121022 on windows 7. I'd like to upgrade to the current latest version 1.9.4-preview20140611. I downloaded the installer Git-1.9.4-preview20140611.exe and ran it. It complains that I'd need to close Windows Explorer:
Clicking next just brings up an error. How am I supposed to upgrade git? Am I supposed to open the task manager and find that pid and kill it? Also my existing git installation is not in the standard program files folder, is the installer going to ask where I want to install git (so far it hasn't)?

First - reboot. You just may have a rogue run-away explorer process. It is, however, a tiny bit safer to reboot than to just kill it by its PID IMHO.
If that doesn't help - log into Windows with your admin user. With any luck it won't have the shell integration running and will not have the needed files in-use. Install your new GiT from that admin account.
If that still doesn't help... Time to use the "kill by PID" way and force your way through!
Good luck :)

Related

I've installed GIT on Windows 7 32-bit and Git Bash is not opening

So I just started learning about GIT and installed GIT on my system. Everything is working: Git GUI, Git CMD, except Git Bash. It doesn't show any errors, it just doesn't open. I tried opening it as an admin, didn't worked. Or even opened through CMD, didn't worked either. Then I tried:
Creating a folder on desktop.
Right Click.
Selected "Git Bash Here" and it created a file named "mintty.exe.stackdump"
The screenshot of file created..
I didn't know what does it mean, or what can I do to make it Git Bash work. I hope someone can explain to me what happened or what can I do to solve this.
Go to the below official community group from git and there you will find github link for updated version 2.28 for windows with fix of bug git-bash launch.
Download the rco-32bit.exe from there and it will work fine.
2.28 version was announced on 10th July so no worries it will appear on site soon.
https://groups.google.com/forum/?fromgroups#!forum/git-for-windows

cygwin update cause "Error: could not fork child process: Resource temporarily unavailable."

I updated my cygwin using the setup-x86_64.exe tool (version 2.873) on Windows 7.
I needed to install some additional packages (mostly zip/unzip etc).
Since then, I am getting the following errors when I try to run the Cygwin Terminal (the shortcut points to C:\cygwin64\bin\mintty.exe -i /Cygwin-Terminal.ico -):
Error: could not fork child process: Resource temporarily unavailable.
DLL rebasing may be required. See 'rebaseall / rebase --help'.
I searched online how to run the rebaseall command they advise in the message. Essentially the recommendation was to start cygwin/bin/dash.exe and run:
bin/rebaseall
I did that a few times, I also used the -v comment, and no errors come back. Still I can't start cygwin.
I also tried running cygwin-x/XWin-server nothing happens.
I looked at the setup logs in cygwin/var/log/setup.log I can't see any error.
I tried to run the setup program a few more times reinstalling some of the packages I already had, that didn't help neither.
Any ideas how can I get that to work?
Here is the fix.
Go to you Windows Defender Security Center settings
Click on App & Browser Control
At the bottom click on the "Exploit Protection Settings" link
Go to "Program Settings" and click on the "Add program to
customize" -> "Choose exact file path"
Navigate to "C:\Program Files\Git\usr\bin\sh.exe" and add it
Override and turn off the following: Mandatory ASLR, Randomize memory allocations (Bottom-up ASLR)
Click "Apply" and now everything should work fine.
Also add these other binaries from the same folder: expr.exe, uname.exe, grep.exe, rm.exe
Good luck,
Gabriel
One of my colleagues has similar errors when openening the terminal from SourceTree (Mingw32), and also got errors when trying to pull, rebase, etc (anything not local). He solved it by uninstalling Sourcetree, using CCleaner to clean his registries (not sure if this was required), rebooted and installed Sourcetree again.
I know this is slightly different from the problem described by the OP, but it might still be solvable by un/re-installing and cleaning of registries, and this might also help future people finding this question with the Sourcetree issue (like I did).
Edit:
Another colleague had the issue as well, and he managed to fix it merely with a restart without any un/re-installation or using CCleaner.
I've been suffering similar problems a lot recently. I've been unable to determine the cause, whether it's due to a recent Windows7 patch or an update in the latest cygwin. I'm in a tightly controlled corporate environment with only limited elevated rights, a lot of anti-malware and encrypted drives. I'm using 32-bit Cygwin at present.
Issues for me began after I installed Git and Git-Svn packages, which required Perl and upgraded various other Cygwin packages as well.
Rebasing using rebase-trigger or rebaseall did not solve the issue for me. Neither did re-installing and setup repeatedly raised errors in the post-install pahse when trying to do the rebase itself.
My first success was by downgrading Perl to the previous version, ie. down to 5.22.1.2 from 5.22.2.1. After a couple of weeks the error returned, perhaps after a compulsory windows update and reboot.
My latest success has been achieved by ignoring the dash/rebaseall script and running rebase.exe directly as follows:-
Create a file which lists all cygwin .dlls in the /bin directory except cygwin1.dll and cyglsa.dll ie.
$ cd /bin
$ ls -1 *.dll | egrep -v '(cygwin1|cyglsa).*\.dll' >rebasedlls.txt
Close all cygwin terminals, if you have any services running which use cygwin ensure that those are stopped also. Check TaskManager and kill processes if necessary.
Open a cmd.exe window (it may help to use whatever elevated rights you can muster), change to the windows path of your cygwin /bin directory (ie. the windows directory of cygpath -wa /bin).
Use rebase.exe directly to find the base address of the cygwin1.dll file:
C:\apps\cygwin\bin> rebase.exe --info cygwin1.dll
/usr/bin/cygwin1.dll base 0x61000000 size 0x00500000
Using that base address and the size as a guide I chose the next whole value up as my rebase base address, 0x62000000. No particular reason for this, just a hunch. (The rebaseall script uses 0x70000000).
Use rebase.exe to fix all the .dlls listed in the file from step (1):
C:\apps\cygwin\bin> rebase -b 0x62000000 -4 -n -v -t -T rebasedlls.txt
So far, so good, my Cygwin is back to a working state again.
From https://chromium.googlesource.com/chromium/src/+/master/docs/cygwin_dll_remapping_failure.md
Handling repeated failures of rebaseall to allow cygwin remaps
Sometimes DLLs over which cygwin has no control get mapped into cygwin
processes at locations that cygwin has chosen for its libraries.
This has been seen primarily with anti-virus DLLs. When this occurs,
cygwin must be instructed during the rebase to avoid the area of
memory where that DLL is mapped.
Background
Some background for this is available on
http://www.dont-panic.cc/capi/2007/10/29/git-svn-fails-with-fatal-error-unable-to-remap/
Because of unix fork semantics (presumably), cygwin libraries must be
mapped in the same location in both parent and child of a fork. All
cygwin libraries have hints in them as to where they should be mapped
in a processes address space; if those hints are followed, each
library will be mapped in the same location in both address spaces.
However, Windows is perfectly happy mapping a DLL anywhere in the
address space; the hint is not considered controlling. The remapping
error occurs when a cygwin process starts and one of its libraries
cannot be mapped to the location specified by its hint.
/usr/bin/rebaseall changes the DLL hints for all of the cygwin
libraries so that there are no inter-library conflicts; it does this
by choosing a contiguous but not overlapping library layout starting
at a base address and working down. This process makes sure there are
no intra-cygwin conflicts, but cannot deal with conflicts with
external DLLs that are in cygwin process address spaces
(e.g. anti-virus DLLs).
To handle this case, you need to figure out what the problematic
non-cygwin library is, where it is in the address space, and do the
rebase all so that no cygwin hints map libraries to that location.
Details
Download the ListDLLs executable from
sysinternals
Run it as administrator while some cygwin commands are running.
Scan the output for the cygwin process (identifiable by the command) and for
DLLs in that process that do not look like cygwin DLLs (like an AV). Note
the location of those libraries (there will usually only be the one).
Pick an address space location lower than its starting address.
Quit all cygwin processes.
Run a windows command shell as administrator
cd in \cygwin\bin
Run ash /usr/bin/rebaseall -b <base address> (This command can also take a
-v flag if you want to see the DLL layout.)
That should fix the problem.
Failed rebaseall
If you pick a base address that is too low, you may end up with a broken cygwin
install. You can reinstall it by running cygwin's setup.exe again, and on the
package selection page, clicking the "All" entry to Reinstall. You may have to
do this twice, as you may get errors on the first reinstall pass.
I have Administrator access to my PC. For me the solution to this was to run the Cygwin session as Administrator -- right the icon, run as administrator, as shown here:
After running as Administrator the first time, new Cygwin sessions started up without hassle.
There is a rebase utility that triggers the rebase as post-setup phase.
From dash or bash:
/usr/bin/rebase-trigger full
close all process and run again setup-x86_64.exe.
uninstall it,
and install the software for 32-bit.
I restarted 3 times, and then it was fine. wtf Windows 7
This exact same error message has various causes, not all of them related to setup-x86_64.exe, although I have seen it in that context as well. But if rebaseall didn't fix your problem, here's a suggestion that might work.
In the case I saw this morning, it turned out to have been caused by having a couple of processes that continued to run after I exited the mintty terminal emulator. My hunch is that these zombie processes prevent the console from being recycled. In my case, the two processes were determined experimentally, by reviewing a list of running processes for stray processes that are no longer needed. I found the two processes that were blocking me by reviewing the list of running tasks.
C:\WINDOWS\system32>tasklist | grep Console
CobraWinLDTP.exe 31844 Console 1 43,600 K
geckodriver.exe 52640 Console 1 32,164 K
C:\WINDOWS\system32>taskkill /F /PID 31844
SUCCESS: The process with PID 31844 has been terminated.
C:\WINDOWS\system32>taskkill /F /PID 52640
SUCCESS: The process with PID 52640 has been terminated.
I saw on some other stackoverflow questions that git is often the zombie process that causes this symptom (for some users). Unfortunately, any residual process that survives after your console session is closed can cause this problem, so you have to experiment.
Go to The Task manager
Kill 'Git for Windows' process
Reopen your git bash
It seems that all is working fine.
NOTE: In case you don't find 'Git for Windows' process and still have to face the same just kill 'Node.js: Server-side JavaScript' process instead
If you have turned Force randomization for images (Mandatory ASLR) on in Exploit protection of Windows Security, then you can turn it off by selecting Use default (Off) to address this issue.
My instance of this problem was also related to having turned on 'force randomization for images' in the Windows Security exploit protection settings.
After you change the setting back to the default off position and reset, you will have to run Git as an administrator in order to effect directory changes which apparently require elevated permission.
I wasn't able to determine a way to allow that setting to be turned on and not get this issue with Git though I played around with it for a while unsuccessfully.
Turning even optional security features off to get a single program working seems like a last resort option to me. However, this isn't just any program either.

How do you upgrade your git installation using the windows command prompt?

I recently installed railsinstaller on my computer, but have noticed that the installation for git that came with the application is old. I wanted to install it through the git installer, but it never showed me where I would like for the location of git to be at. My other solution is to upgrade it through the command prompt without using the git installer. How do I do this? Which commands would I have to use in the command prompt terminal?
Installing software from the command prompt isn't an easy task on Windows. First, you will need to find out what technology was used to create the installation package. Then you need to download a (UI based) tool which can modify the installation package to stop asking questions and just do what you want. It's certainly possible ... if you can spend a couple of hours or days to find out how.
Now the reason why the git installer isn't asking is probably because it detects an existing install and wants to upgrade it - since the "new" place must be the old place, no question is asked. To "fix" this, you can try to deinstall Git (Control Panel -> Installed Software -> Remove). When you run the installer again, it should give you more options.
If you just want to update the command line tools, you can also try to unpack the installer or install on a second computer. That should give you the git.exe plus all the DLLs and scripts which you can then copy manually. But Git on Windows also install a MINGW environment with a shell and to update that, you probably have to run the installer so it can make the necessary changes to the registry.

Unable to Open/Install Git on Windows 10

When I open the file I downloaded from https://git-scm.com/download and then Windows, nothing happens. I've tried running it as a normal user and administrator but nothing happens. Not even a processor in the Task Manager opens.
What could cause this? Is it because Git hasn't been updated for Windows 10 yet, or is it something else? I just did a clean install of Windows 10.
Perhaps, you could try chocolatey (even if I'm not sure it will change something...) :
https://chocolatey.org/packages/git
Or the RC for the next to be released git for Windows :
https://github.com/git-for-windows/git/releases
Try running the installer from command prompt.
More details
This is what just happened to me. When double-clicked, or even ran as admin, Git-2.34.1-64-bit.exe shows this. None of those 3 buttons work.
The only thing that helped was running the file from command prompt.
This is a weird one.
Update
A similar thing just happened again with node-v17.3.0-x64. This time, I would get this screen even when running from command prompt.
But it would work just fine if the cmd.exe is ran as an administrator.
It's maddening.

GitHub GUI for Windows: uses old version

I have Windows 8.1 on my laptop and I've installed Git. If I type git --version in Windows' command prompt, the result is git version 1.8.5.2.msysgit.0. I can commit and update all the stuff on the server, everything works fine.
At the same time, I'd like to have a GUI for that so I've installed GitHub for Windows. Unfortunately, it does not let me commit my changes as it report that there is an error as suggests opening a shell (also console-like, but looks different from usual Windows' cmd). If I type in that shell git --version I get git version 1.8.4.msysgit.0 so apparently the GUI app uses an older version of git than the one I need, although I have a needed version of Git installed on my computer.
I appreciate any hints on how to make the GUI app to use the new version of git. If any details are still needed, please tell me - I'll provide them asap. Thanks
You will find the git (embedded in G4W -- GitHub for Windows as SLaks mentions) in
%LOCALAPPDATA%\GitHub\Portable_Git_xxxxx\
(See "Can the credentials stored in Github for Windows be shared with the whole operating system?")
You can try and replace that folder by a portable Git, PortableGit-1.8.5.2-preview20131230.7z: once uncompressed, you can rename the folder with the same name 'Portable_Git_xxxxx' and see if that works.

Resources