Sudo
GitHub Blog Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Back to homepage

Source Repo

Read-only access to the sudo source repository (from as far back as 1993) is available for checkout using mercurial or git. If you are interested in contributing to sudo, the easiest way is probably via GitHub.

Cloning the sudo source repo via mercurial

The main sudo source repo is located at https://www.sudo.ws/repos/sudo.

To download a copy of the repo you must first install mercurial. You can then make a clone of the repo by running:

hg clone https://www.sudo.ws/repos/sudo

This will create a copy of the sudo repo on your local machine in the sudo directory. This step only needs to be done once.

By default, this will check out the tip of the main development branch. To check out a copy of the sudo 1.9 source files, change to the sudo directory that you just created and run:

cd sudo
hg update 1.9

This will populate the sudo directory with the sudo source files for the tip of the sudo 1.9 branch.

If you want to checkout a specific version of sudo, you can use the symbolic tag for that release. For example, to check out sudo version 1.9.0 you would do:

hg update SUDO_1_9_0

Once you have the source tree checked out, you can update it thusly:

cd sudo
hg pull
hg update

The hg pull will pull in changes from the master repo, the hg update will update the working copy from your local repo. This can be done in a single step with hg pull -u which will pull in changes and update the working copy.

You can also do standard operations like log, diff, and annotate. While you can check in changes to your local copy of the repo, you will be unable to push the changes directly upstream. Changes may be submitted in the form of patches or change bundles.

If you are new to mercurial, the mercurial guide is a good place to start.

Cloning the sudo source repo via git

While sudo is primarily developed using mercurial, many developers are more comfortable with git. There are two official git mirrors of the sudo source repo: one at GitHub and one at Bitbucket. The following examples will use GitHub.

To download a copy of the repo you must first install git. You can then make a clone of the repo by running:

git clone https://github.com/sudo-project/sudo.git

This will create a copy of the sudo repo on your local machine in the sudo directory. This step only needs to be done once.

By default, this will check out the tip of the main development branch. To check out a copy of the sudo 1.9 source files, change to the sudo directory that you just created and run:

cd sudo
git checkout sudo-1.9

This will populate the sudo directory with the sudo source files for the tip of the sudo 1.9 branch.

If you want to checkout a specific version of sudo, you can use the symbolic tag for that release. For example, to check out sudo version 1.9.0 you would do:

git checkout SUDO_1_9_0

Once you have the source tree checked out, you can update it thusly:

cd sudo
git pull

This will pull in changes from the master repo and merge them into your local repo. To fetch upstream changes without merging them or updating the local copy, use:

cd sudo
git fetch

You can also do standard operations like log, diff, and annotate. While you can check in changes to your local copy of the repo, you will be unable to push the changes directly upstream. Changes may be submitted in the form of pull requests.

If you are new to git, the Git Handbook is a good place to start.

Browse Online

You can also browse the sudo source tree with on the web by clicking on the browse link at https://www.sudo.ws/repos/sudo. This provides a nice interface and can be handy when you don’t necessarily want to check out a full copy of the source tree. Note that there are several branches and the default branch (the trunk) may not be the one you want. Stable (released) versions of sudo are built from a named branch with a major and minor number, e.g. 1.9, 1.8, 1.7 and 1.6. To view a specific release, use that release’s tag, e.g. hg up SUDO_1_9_0. You may also browse the sudo source tree on GitHub.

Caveats

Prior to sudo version 1.5.8, the source tree was stored in RCS without the use of symbolic tags. While there are symbolic tags for versions previous to 1.5.8, not all files included in those distributions have corresponding versions in the source tree.