Session 8: GitHub - Intro

Track, organize and share your work: An introduction to Git for psychological research

Course at University of Hamburg

Slides | Source

License: CC BY 4.0 DOI

May 20 2024 (12:15 pm)

1 Schedule

Schedule

No Date Title Contents Reading Survey/Quiz
1 2024-04-08 Introduction to version control Organisational matters
Overview of seminar sessions
Introduction to version control
Introduction to Git and its advantages
Intro to version control Course introduction Survey
2 2024-04-15 Command line File Systems
Benefits of the Command Line
Basic Command Line commands
Command Line Command Line Quiz
3 2024-04-22 Setup + Git Fundamentals Installation and configuration of Git
Initializing a Git repository
Basic Git commands
Installation, Setup, First steps with Git Installation Survey, Git Basics Quiz
4 2024-04-29 Basic Git workflow Practicing basic Git commands
Ignoring files with .gitignore
Good commit messages
First steps with Git Git Basics Quiz
5 2024-05-06 Git Branching and Merging Understanding branches in Git
Creating and switching between branches
Merging branches
Resolving merge conflicts
Branches Git Branches Quiz
6 2024-05-13 Quarto Workshop Introduction to Quarto
7 2024-05-20 Whit Monday Cancelled
8 2024-05-27 Introduction to GitHub Introduction to remote repositories
Creating a GitHub account
Creating and managing repositories on GitHub
Pushing and pulling changes
GitHub Intro GitHub Quiz
9 2024-06-03 GitHub with collaborators Cloning a remote repository
Branching and merging in a collaborative environment
Pull Requests
GitHub Issues
Graphical User Interfaces (GUIs), e.g., GitKraken
GitHub Intro, GitHub Issues GitHub Quiz
10 2024-06-10 GitHub with the world Forking a remote repository
README files
Project Management
GitHub Intro, GitHub Issues GitHub Quiz
11 2024-06-17 Repetition and Practice Repetition and Practice
12 2024-06-24 Publishing Creating Tags with Git
Creating Releases with GitHub
Using Zenodo for scientific publishing
Licences
Citation Files
Tags and Releases
13 2024-07-01 Graphical User Interfaces (cancelled) Repetition and Practice
Introduction to using GUIs
Graphical User Interfaces
14 2024-07-08 Summary & Wrap-Up Course evaluation
Repetition and Practice
Introduction to using GUIs
Graphical User Interfaces

2 Last Session

Last session: Quarto Workshop

https://lennartwittkuhn.com/version-control-course-uhh-ss24/sessions/session06

Last week: Questions about Quarto?

Important note: Git repository in user folder?

  • Please make sure that your recipes repository is in a suitable place (for example, in the Desktop, Documents folders or where you keep your university-related files, …) and not in your user directory!
  • Also: Always remember to cd into your repository before you execute Git commands!
  • If your repository is in your user directory, please tell Lennart and we can fix it.

Tip: To prevent ever creating a Git repository inside your user folder, you can use:

Code
touch ~/.git

Running git init in the user directory now results in a (desired) error:

Output
fatal: invalid gitfile format: /Users/user/.git

Thanks to Eamon Caddigan for the idea!

3 This week: Introduction to GitHub

Today’s topic: Introduction to GitHub

Image from Techdobz

This weeks learning objectives

Today’s chapter

https://lennartwittkuhn.com/version-control-book/chapters/remotes-intro.html

Your turn

  1. Content Review: Read the chapter “GitHub - Intro” in the Version Control Book.
  2. Implementation: Try out the commands in the chapter! Play around! Have fun!.
  3. Note: Please complete the implementation exercises on the next slide

Ask questions!

Let’s git started!

Implementation exercises

Task 1: Upload and manage your repo on GitHub

  • Connect your GitHub account
    1. Generate a personal access token (PAT) on GitHub
    2. Use the PAT for GitHub authentication
  • Upload your repository
    1. Create a new private(!) repository on GitHub.
    2. Set the remote URL for your local Git repository.
    3. Push your main branch to GitHub.
  • Optional: Manage branches
    1. Push other branches with changes to GitHub.
    2. Delete unused branches.

Task 2: Maintain your repo and collaborate

  • Clean up your repository on GitHub:
    1. Delete unnecessary files or add a new recipe.
    2. Commit changes with a message.
    3. Pull the changes to your local repository.
  • Collaboration:
    1. Add collaborators to your repository: Lennart (@lnnrtwttkhn) and Konrad (@konradpa).

Task 3: Create a README file

  1. Navigate to your repository on GitHub, click “Add file”, and select “Create new file”.
  2. Name the file README.md, add a brief description of your project, and provide a commit message. Play around with Markdown syntax!
  3. Click the green “Commit new file” button to save the README.md file to the repository.
  4. Pull the changes to your local repository.

Implementation exercises (optional bonus)

Task 4: Clone and synac your repo (optional)

  1. Clone your repository from GitHub to a different location on your computer.
  2. Make and push changes.
  3. Pull changes to the repository in the original location.
  4. Delete your newly cloned repository.