Mercurial not working after TortoiseHg update - windows-7

I recently updated TortoiseHg to 2.0.3 (with Mercurial 1.8.2). After updating, Mercurial no longer works via the command line (Windows 7 x64), but does work via the TortoiseHg GUI. Trying to use any Hg commands via the command line results in the error message 'hg' is not recognized as an internal or external command, operable program or batch file.'
I'm guessing I need to make some change to a setting in TortoiseHg or Windows 7 so that Windows will recognize hg commands, but I'm not sure what that change is. I am very new to using Hg - I installed it a few months ago (thus the need for an update), but only recently started using it.

I fixed this by removing the "/" at the end of the Path:
From
"C:\Program Files\TortoiseHg\"
to
"C:\Program Files\TortoiseHg"

TortoiseHg v2.X.X no longer uses the hg command, instead try thg.
Your install path might be different, but typically thg.CMD exists at:
C:/Program Files/TortoiseHg/bin/
If you've installed Mercurial independent of TortoiseHg you may still have access to the hg executable, but most people just install TortoiseHg and take the associated copy of Mercurial, in which case you would need to use the thg commands.

I had to remove the leading quotation mark - the PATH variable contained:
...;"C:\Program Files\TortoiseHg
and I changed it to
...;C:\Program Files\TortoiseHg
to make it work with Red-Gate SQL Source control.

Related

Windows 10 cannot recognize Git

I have installed Windows 10 x64 on my laptop, and then go with latest Git as well (Git-2.6.3-64-bit). As I see on my laptop, Git now is installed at this directory: C:\Users\MyPC\AppData\Local\Programs\Git (I have no chance to specify another particular folder because it's done automatically during Git installation). The options "Use Git from the Windows Command Prompt" and "Use OpenSSH" are already selected, the windows path is updated with Git dir. And after all, the problem is, Windows cannot recognize where Git is to call. I've tried git --version but it's unrecognized from Windows.
My questions are (on Windows 10 Pro x64):
1. Can we specify another installation folder for Git?
2. In Git dir/bin, there no ssh.exe, while in OpenSSH selection dialog, it tells me "This uses ssh.exe that comes with Git". So where is it, the built-tin SSH client?
3. I'm doubting that now Windows 10 doesn't accept any external program installed on %USERPROFILE%/AppData to be included to system path. Is it correct?
4. How to make Windows "see" Git?
Just solved this myself this was a very frustrating journey but for me the following got me going:
Make sure c:\Windows\System32\OpenSSH\ is in your path variables (yea I know Windows should see this on its own)
Go to C:\Users\<>.gitconfig edit your global git config file to point to the correct ssh.exe 'C:/Windows/System32/OpenSSH
Make sure your id_rsa.ppk file is in C:\Users\<>.ssh If you don't have an SSH key yet generate one and make sure it ends up in this folder
You may also want to check that your OpenSSH Authentication Agent is started in Windows Services
Can we specify another installation folder for Git?
Try running the installer as an administrator, so it can be installed to Program Files. I'm not sure how to specify a custom path.
In Git dir/bin, there no ssh.exe, while in OpenSSH selection dialog, it tells me "This uses ssh.exe that comes with Git". So where is it, the built-tin SSH client?
Some digging told me that it might live inside the .ssh folder in the Git installation, so C:\Users\MyPC\AppData\Local\Programs\Git\.ssh
I'm doubting that now Windows 10 doesn't accept any external program installed on %USERPROFILE%/AppData to be included to system path. Is it correct?
AFAIK you can add any directory to your path.
How to make Windows "see" Git?
Add C:\Users\MyPC\AppData\Local\Programs\Git to your path:
Start the System Control Panel applet (Start - Settings - Control Panel - System).
Select the Advanced tab.
Click the Environment Variables button.
Under System Variables, select Path, then click Edit.
You'll see a list of folders, as this example for my system shows: C:\Program Files\Windows Resource Kits\Tools\;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\Program Files\Support Tools\;C:\Program Files\Common Files\Roxio Shared\DLLShared;C:\Program Files\Common Files\Ulead Systems\MPEG;C:\Program Files\Intel\DMIX;C:\Program Files\Executive Software\Diskeeper\;C:\Program Files\Bonjour\;C:\Program Files\QuickTime\QTSystem\;C:\Program Files\Misc
You can add additional folders that you want to include in searches. I add a "C:\program files\misc" entry into which I place my standalone utilities, instead of copying them into C:\windows. Click OK.
You'll need to restart the processes (e.g., command prompt) that use the system path to see the added folders.
From http://windowsitpro.com/systems-management/how-can-i-add-new-folder-my-system-path

SourceTree 1.6.14 cannot find Git 2.4.0 installation on Windows

After installing Git 2.4.0 on my Windows 7 system, I tried to change the option in SourceTree 1.6.14 to "Use System Git", rather than the embedded version.
However, upon clicking "Use System Git", nothing happened and the setting remained set to "Use Embedded Git".
How can I make SourceTree use the installed version of Git?
This will be probably fixed in a future patch for SourceTree, however, until it does there is a workaround as follows.
Git versions prior to 2.0 stored git.exe in a subdirectory called bin and this is what SourceTree is looking for. As of Git >=2.0, git.exe moved into a folder named cmd.
Therefore, the easiest way to get SourceTree to recognise your Git installation, is to create a symbolic link for the folder using mklink as follows:
C:\Program Files (x86)\Git\>mklink /D bin cmd
Edit:
Whilst the above fixes Git for the normal GUI operations (commit/push etc.) it does not fix the "Terminal" button, as this command tries to execute sh.exe via the following command and fails as sh.exe has also been moved in Git 2.4.
"C:\Windows\System32\cmd.exe" /c "C:\Program Files (x86)\Git\bin\sh.exe" --login -i
Edit 2: Further reading - this was raised as an issue by the Git for Windows maintainers here.

svn export and deployment on WINDOWS

How to deploy the code from SVN to WINDOWS envronment?
I am looking to execute the following steps:
'svn export' (only changed files after certain revisons) from WiNDOWS command line.
Deploy the changed files on WINDOWS environment.
Thanks.
You need to install a command line SVN client on Windows first. TortoiseSVN's recent versions reportedly include one. Then you need to use the same commands you did under linux. I think you actually mean 'svn co' not 'svn export' which assumes you already have checked out copies on your local file system.

Changing my mind about the PATH when setting up Git for Windows

I have Git on my Windows 7 computer, and when I set it up, I chose Git Bash only, to be safe. Now, I want to install Aptana Studio 3, and one of the requirements is that I have Git, with the ability to use Git from the command line, which I understand is not the case now. How can I go back and change that setting?
Have you tried reinstalling Git? Many windows installers support the concept of reinstalling, allowing you to pick your installation options again.
If that doesn't work, I'd suggest uninstall/reinstall.
You can just edit the system PATH environment variable to include c:\Program Files\Git\cmd or wherever you installed Git to. The git.cmd and gitk.cmd batch scripts setup the right environment and that is all the installer does for you.

git without bash/cygwin

I'm on a vista laptop, trying out git for the first time.
I installed the msysgit version, and it installed a "git bash" shortcut on the desktop. When I run it, it seems to run in a cygwin kind of box, where C:\ is /c/
Is it safe to use git from the windows command line where /c/ is C:\? does that create any conflict with the way git expects the pathes to be like?
What about, if I init from the bash/cygwin console, then commit from the windows console? Does that create any trouble?
Note: Keep in mind that git does not track where the repository is at -- just references. In other words you can cleanly move an entire git directory (.git + working tree) and it still works fine.
It should work in either case assuming your environment variables allow you to run git from the windows command line.
Both point to the same actual directories (although referenced differently), and use the same executable to modify the repository.
When you install MSYS Git, it will give you 3 options related to system paths. Which one you choose will determine how you can use it. It sounds like you want the 3rd option, "Run Git and included tools from the windows command prompt". This will put all of the git-related binaries in the system path, allowing you to use git from a normal command prompt. Be aware that it also overrides a few built-in windows tools, as the warning in the installer says.
After installing msysgit, you should be able to right click on an empty folder and see options "Git GUI here" and "Git BASH here". If you click Git GUI here it will open a GUI. Have fun!

Resources