hg.exe

Mercurial Version Control - Command Line Tool

Application ProcessSafeVersion Control
CPU Usage
0.5-5%
Memory
40-180 MB
Location
Program Files\Mercurial
Publisher
Mercurial Project

Quick Answer

hg.exe is safe. It's the official Mercurial command-line interface. It runs as a lightweight executable that delegates heavy operations to the Python-based Mercurial runtime.

Is it a Virus?
ully NO - Safe
Must be in Program Files\Mercurial\hg.exe
Warning
Most operations spawn subprocesses for I/O
Mercurial uses a single hg.exe to run commands; network or heavy I/O may spawn child processes
Can I Disable?
 YES
Close a running command window or disable startup tasks; modules may be integrated with IDEs

What is hg.exe?

hg.exe is the Windows executable for the Mercurial version control system. It provides the command-line interface used to run Mercurial commands such as clone, commit, pull, and push. Hg.exe launches the Python-based Mercurial runtime and coordinates operations, often spawning subprocesses for network I/O and file operations, enabling reliable, isolated task execution.

This executable delegates most work to the Mercurial engine written in Python. On Windows, hg.exe manages command parsing, I/O, and subprocess orchestration, allowing operations to run with isolation and stable error handling.

Quick Fact: Mercurial's hg.exe acts as a launcher for commands; many operations are handled by the Python runtime, which helps keep the CLI responsive and stable.

Types of Hg.exe Processes

Is hg.exe Safe?

Yes, hg.exe is safe when it's the legitimate file from Mercurial downloaded from official sources (mercurial-scm.org or the official installer).

Is hg.exe a Virus or Malware?

The real hg.exe is NOT a virus. However, malware can disguise itself with similar names.

How to Tell if hg.exe is Legitimate or Malware

  1. File Location:: Must be in C:\Program Files\Mercurial\hg.exe or C:\Program Files (x86)\Mercurial\hg.exe. Any hg.exe elsewhere is suspicious.
  2. Digital Signature:: Right-click the file > Properties > Digital Signatures. Should show a valid signer like "Mercurial Project".
  3. Resource Usage:: In Task Manager, ensure the path listed for hg.exe is the expected one and observe typical CPU/memory usage per operation.
  4. Behavior:: Hg.exe should only run when you invoke Mercurial and should terminate after the command completes; persistent background activity may indicate malware.

Red Flags: If hg.exe is located in unusual folders (like Temp or AppData\Roaming) or runs when you aren’t using Mercurial, or lacks a valid signature, scan with antivirus software. Beware of similarly-named files such as "hgconsole.exe".

Why Is hg.exe Running on My PC?

hg.exe runs when you invoke Mercurial commands or when a tool integrates with Mercurial to perform repository operations in the background.

Reasons it's running:

Can I Disable or Remove hg.exe?

Yes, you can disable hg.exe. It's safe to close terminal sessions when not in use, and you can uninstall Mercurial if you no longer need it.

How to Stop hg.exe

How to Uninstall Mercurial

Common Problems: High CPU or Memory Usage

If hg.exe is consuming excessive resources:

Common Causes & Solutions

Quick Fixes:
1. Quick Fixes:
2. 1. Open a Mercurial command prompt and press Ctrl+C to cancel long operations
3. Limit open repositories to reduce concurrent activity
4. Disable unnecessary extensions in hgrc and remove unused ones
5. Update Mercurial to the latest version from mercurial-scm.org
6. Check for and apply memory-saving options in your repository configuration

Frequently Asked Questions

Is hg.exe a virus?

No, the legitimate hg.exe from Mercurial is not a virus. However, always verify the file is located in C:\Program Files\Mercurial\hg.exe and has a valid digital signature from "Mercurial Project". Malicious files may use similar names.

Why is hg.exe using so much CPU?

High CPU usage is usually caused by specific operations on large repositories, or by misbehaving extensions. Use your terminal or Task Manager to identify the exact command; close or optimize the operation, update Mercurial, and check extensions for issues.

Can I delete hg.exe?

Yes, you can uninstall Mercurial via Windows Settings → Apps. Your repository data is separate; deleting hg.exe removes the CLI, but you can reinstall later from mercurial-scm.org.

Can I disable hg.exe?

Yes, you can close terminal sessions or disable startup items. To stop background operations, disable repository monitors or IDE integrations that call hg.exe.

Why is hg.exe running at startup?

Mercurial tools are not typically set to start automatically, but IDE integrations or server tools can launch hg.exe on Windows startup. Disable these in Task Manager > Startup.

Why are there so many hg.exe processes?

Mercurial uses a modular command flow; certain operations may spawn subprocesses for I/O. Realistically, you should see one main hg.exe per active terminal; multiple independent processes indicate parallel tasks or tools.

How do I reduce Mercurial's memory usage?

Close unused repositories, disable unnecessary extensions, and update to the latest Mercurial. Consider performing large operations in smaller batches and using memory-saving settings where available.

Related Processes