Skip to main content
\( \newcommand{\lt}{<} \newcommand{\gt}{>} \newcommand{\amp}{&} \)

SectionE.3Installing git

In this section we install the git version control system and some tools to interact with it, including a fairly full-featured emulation of the bash command line shell. I strongly recommend you use the Git Bash shell or another bash emulation, so that you can use Linux commands referenced elsewhere.

One feature in particular, pdfcrop, has not been made to work in the normal Windows cmd shell, although the rest of PreTeXt has. To generate images using the mbx script Section 9.4, you will need the Git Bash shell or something like it.

SubsectionE.3.1Steps to install git

  1. Visit the official git download page (download starts automatically) and obtain the latest binary for your system.

  2. Find the installer in your Download location and run it.

  3. Choose whatever location you like for the git installation folder. I recommend you use the default.

  4. At the “Adjusting your PATH environment” dialog, select either of the first two items. I recommend the second, “Add git executable to Windows PATH”. This will allow you to use git from within other Windows programs, such as Sublime Text or other text editors, which can be extremely convenient. If you are apprehensive about adding git to the Windows PATH, select the first option. I do not recommend the third option.

  5. Accept the default options for all the remaining prompts.

SubsectionE.3.2Changing the path with .bashrc

In Subsection E.2.2, we promised that you could avoid messing with the Windows environment variables. If you install something else later that wants to use xsltproc, then this might not be the best idea. But if you are only going to use it from within Git Bash, then this will work fine.

From the Git Bash command prompt, enter this line of text and hit Enter. Do not make any typos. You should substitute your value of <xsltproc> where indicated, but make sure to conform to the conventions at the end of Subsection E.1.3 regarding Windows path names in Git Bash. (I warned you this was going to be annoying.)

echo "export PATH=<xsltproc>:$PATH" >> ~/.bashrc
You may get a message from Git Bash the next time you run it about .bash_profile, which you may safely ignore.

Congratulations, you have successfully installed git.