Home
Setup
Committing
Eclipse and Git
FAQ

Setting up a repository

Configuring your name and email

Before using Git on any system for the first time, it is a good idea to set your name and email address, since Git will include this information in each commit message you author. Follow these steps:

  1. Set your name by using this command:
    $ git config --global user.name "<Your Name>"
  2. Set your email as follows:
    $ git config --global user.email <your_email_address>

If you plan to develop on the CS systems

If you intend to write your code on the department's systems (e.g. while connected via SSH), all you need to do is initialize a standard Git repository. To do this, follow these steps.

  1. Make sure you've set your name and email, as detailed in the above section. To check, look for this information in the output of the command:
    $ git config --global -l
  2. Move into the folder where you keep your work for the course, for example by running the command:
    $ cd ~/Courses/CS/CS1/Labs
  3. Create a repository in a new folder of your choice. For instance, to create one called Lab1, run:
    $ git init Lab1
  4. This should result in a message being printed in the terminal, eg:
    Initialized empty Git repository in ~/Courses/CS/CS1/Labs/Lab1/.git/
    (Note: the exact path may differ based on your exact setup!!)
  5. On the offchance that this message was not printed, there is another way to check whether your repository was successfully created. To do this, navigate into the new directory and list its contents with the following series of commands:
    $ cd Lab1
    $ ls -a
    Now look for the hidden .git folder. This folder identifies the directory as a Git repository. If you see it, you know the init was successful!