Setting Up Git

To work on the Sage source code, you need

  • a working git installation, see Installing Git. Sage actually comes with git, see below. However, it is recommended that you have a system-wide install if only to save you some typing.
  • configure git to use your name and email address for commits, see Your Name and Email. The Sage development scripts will prompt you if you don’t. But, especially if you use git for other projects in the future as well, you really should configure git.

The Tips and References chapter contains further information about git that might be useful to some but are not required.

Installing Git

First, try git on the command line. Most distributions will have it installed by default if other development tools are installed. If that fails, use the following to install git:

Debian / Ubuntu
sudo apt-get install git-core
sudo yum install git-core
Download and install Git for Windows
Use the git OSX installer. If you have an older Mac, be sure to get the correct version. (Alternately you may get it from the Command Line Tools or even simply by attempting to use git and then following instructions.)

Finally, Sage includes git. Obviously there is a chicken-and-egg problem to checkout the Sage source code from its git repository, but one can always download a Sage source tarball or binary distribution. You can then run git via the sage -git command line switch. So, for example, git help becomes sage -git help and so on. Note that the examples in the developer guide will assume that you have a system-wide git installation.

Some further resources for installation help are:

Your Name and Email

The commit message of any change contains your name and email address to acknowledge your contribution and to have a point of contact if there are questions in the future; Filling it in is required if you want to share your changes. The simplest way to do this is from the command line:

[[email protected] ~] git config --global "Your Name"
[[email protected] ~] git config --global [email protected]

This will write the settings into your git configuration file with your name and email:

    name = Your Name
    email = [email protected]

Of course you’ll need to replace Your Name and with your actual name and email address.