> ## Documentation Index
> Fetch the complete documentation index at: https://kb.hosting.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Using the Mercurial version control system

> Learn How to Use the Mercurial Version Control System. Just Follow Our Easy Step-By-Step Mercurial Guide!

This article describes how to use the Mercurial version control system on hosting.com servers.

## About Mercurial

The Python-based Mercurial version control system is installed on all hosting.com shared servers. Like other version control systems, Mercurial enables you to track multiple revisions of files and directories.

## Creating a repository

To create a Mercurial repository, all you have to do is log in to your hosting.com account using SSH, and then type the following command:

```bash theme={null}
hg init repository
```

Replace ***repository*** with the name of the directory where you want to create the repository (if the directory does not already exist, the **hg init** command creates it).

## Publishing a repository

You can publish your Mercurial repositories and make them available to others on the web. To do this, follow these steps:

1. Log in to your account [using SSH](/docs/using-ssh-secure-shell).
2. Type the following command:
   ```bash theme={null}
   cd ~/public_html/cgi-bin
   ```
3. In the *cgi-bin* directory, create a file. Users will use this filename to access the repository, so you probably want to use a name related to the repository that you're publishing.
4. Copy the following text and paste it into the file you just created:
   ```python theme={null}
   #!/usr/bin/env python
   #
   # An example hgweb CGI script, edit as necessary
   # See also https://wiki.mercurial-scm.org/PublishingRepositories
   # Path to repo or hgweb config to serve (see 'hg help hgweb')
   config = "/home/username/repository"
   # Uncomment and adjust if Mercurial is not installed system-wide:
   #import sys; sys.path.insert(0, "/path/to/python/lib")
   # Uncomment to send python tracebacks to the browser if an error occurs:
   #import cgitb; cgitb.enable()
   from mercurial import demandimport; demandimport.enable()
   from mercurial.hgweb import hgweb, wsgicgi
   application = hgweb(config)
   wsgicgi.launch(application)
   ```
5. In the text that you just pasted into the file, replace ***username*** with your hosting.com account username, and replace ***repository*** with the path to your repository.
6. Save your changes to the file.
7. At the command prompt, type the following command. Replace ***filename*** with the name of the file that you created in step 3:
   ```bash theme={null}
   chmod 755 filename
   ```
8. The repository is now accessible on the web at the URL [*http://www.example.com/cgi-bin/*](http://www.example.com/cgi-bin/) ***filename***, where *example.com* represents your domain name, and ***filename*** represents the name of the file you created in step 3. For example, to clone this repository, you would type the following command:
   ```bash theme={null}
   hg clone http://www.example.com/cgi-bin/filename
   ```

## More information

* To visit the official Mercurial website, please visit [https://www.mercurial-scm.org](https://www.mercurial-scm.org).
* To view a complete online Mercurial tutorial, please visit [http://hginit.com](http://hginit.com).
* To view a free online book about Mercurial, please visit [https://book.mercurial-scm.org/](https://book.mercurial-scm.org/).
