Repository setup

Week 0 - Setup session

This discussion section will guide you through setting up a repository where you will collect your notebooks for the course’s discussion sections. In this session, you will:

Setup

There is no setup required by students for this discussion section, the instructor will guide the activities for it.

1. Create repository

  1. Create a new repository on GitHub. Use the following settings:

    • Repository name: eds220-2025-sections.

    • Description: Discussion sections work for the EDS 220 MEDS course.

    • Visibility: Keep the repository public.

    • Don’t select any template to start.

    • Add a README file.

    • Add a Python .gitignore template.

    • Add the MIT License.

  2. In GitHub, update your repository’s README by:

    1. Deleting all the text that was automatically generated when you created the repo.
    2. Copy-pasting the markdown text below, do not update [YOUR NAME HERE] yet.
# EDS 220 Discussion Sections Repository

This repository hosts all the work completed by [YOUR NAME HERE] during the discussion sections of EDS 220 - *Working with Environmental Data*.

## Course Information

- **Course Title:** [EDS 220 - Working with Environmental Datasets](https://bren.ucsb.edu/courses/eds-220)
- **Term:** Fall 2025
- **Program:** [UCSB Masters in Environmental Data Science](https://bren.ucsb.edu/masters-programs/master-environmental-data-science).

Teaching Team:

- **Instructor:** [Carmen Galaz García](https://github.com/carmengg)
- **Co-Instructor:** [Annie Adams](https://github.com/annieradams) 

Complete materials for the discussion sections and additional resources can be found on the [course website](https://meds-eds-220.github.io/MEDS-eds-220-course/discussion-sections/discussion-sections-listing.html).
3. Commit the changes.
  1. Add the URL to your GitHub repository to this spreadhseet.

MAKE SURE YOU’VE SUCCESSFULLY SET UP YOUR REPOSITORY ON GITHUB BEFORE CONTINUING

2. Clone the repository

  1. At Bren’s workbench 1 server, start a new JupyterLab session or access an active one.

  2. Inside your MEDS/ directory, create a new directory called EDS-220. We’ll use this directory to collect all the repositories used in the course. If you do not have a MEDS directory, go ahead and create one.

  3. In the terminal, navigate into the EDS-220 directory by using

cd NAME-OF-DIRECTORY
  1. Using the terminal, clone the repository into your EDS-220 directory. To do this:

    1. In your repository’s landing page on GitHub, click on the green button that says < > Code. In the HTTPS tab option, copy the URL that appears there.

    2. Go back to the server. In the terminal, run

    pwd

    to make sure you’re cloning into the desired location (this should be inside the EDS-220 directory). The command pwd stands for print working directory, it lets you know where you’re at within your files.

    After you run pwd you should get a file path that looks like this:

    /Users/c_galazgarcia/MEDS/EDS-220/
    1. In the terminal, run
    git clone YOUR-REPOS-URL

    The repository directory should appear in the folder navigation bar to the left.

    1. Navigate into the cloned repository in the terminal:
    cd eds220-2025-sections

    The eds220-2025-sections is your local repository, the copy of your repo that lives in your computer and from which you will send updates to GitHub. The remote repository is the copy of your repo that lives in GitHub.

3. Configure git pull.rebase

When you do git pull, git combines the changes from your remote repo with your local repo. There are two main ways: merge and rebase. We will want to merge changes, not rebase. This can be the easier way to handle merges when starting out with git.

  1. Configure the way git handles git pull by running in the terminal
git config pull.rebase false
  1. Verify that your configuration was succesful by running
git config --list

This command shows you all the settings git is using at the moment. Your ouput should look something like this:

user.name=carmengg
user.email=c_galazgarcia@ucsb.edu
credential.helper=cache --timeout=10000000
[...]
pull.rebase=false

If you see pull.rebase=false it means the configuration was successful.

4. Update your name and push changes

  1. In the workbench (not on GitHub!) open the README.md file and update the [YOUR NAME HERE] with your name. Save your changes.

  2. Push your changes to your remote repository (remember, this is how we call the copy of your repo that lives in GitHub). To do this, remember the basic git routine:

    1. git status : check git status, shows which files are staged, modified, or untracked
    2. git add FILE-NAME : stage files that have been updated, these files will be added to your next commit
    3. git status : check git status again to confirm you have staged the right files
    4. git commit -m "YOUR COMMIT MESSAGE" : create a commit with message
    5. git pull : pull latest changes before pushing to ensure your local repo is up-to-date
    6. git push : push your changes to remote repo
Prompted for your username? Abort the push!

There is a chance you might be prompted to provide your GitHub username when you do git push by getting this message on the terminal:

Username for 'https://github.com':   

If this happens, abort the push by pressing Ctrl+C. You will need to set up your credentials on the server in the next step to be able to push your changes.

5. Configure GitHub credentials (if needed)

In this step you will need to create a personal access token (PAT) and configure your GitHub credentials before trying to push your changes.

  1. Follow steps 6 and 7 in the MEDS setup guide to create a new PAT.

  2. Once you have created your PAT, do git push again, enter your credentials (the PAT will be your password), and push your changes.

MAKE SURE YOU’VE SUCCESSFULLY PUSHED YOUR UPDATES BEFORE ENDING