Git and GitHub configuration

getting some version control on your computer
// updated 2025-04-24 16:46

Introduction

We should take note that

  • Git refers to a version control system that tracks changes (called "diffs", short for "differences") to our digital projects (called "repositories")
    • these repositories don't have to include code - they can include just plain text!
    • similar systems include Subversion, Mercurial, etc.
  • GitHub refers to a platform that hosts Git repositories host
    • similar platforms include Bitbucket, OneDev, Codeberg, etc.

Installation

  • Follow the steps in git-scm.com to install Git on your computer

User setup

Now that we have Git installed on the computer, we can "sign in" to GitHub:

Username

When you make a commit, what would you want to show as your name?

  • Open your Terminal
  • Configure your GitHub account globally on your machine (remove --global if you wish to configure your account just for the current repository):
$ git config --global user.name "username"

Let's confirm we have set this up correctly:

$ git config --global user.name
> username

E-mail address

When you make a commit, what would you want to show as your e-mail address?

  • Open Terminal
  • As in the above with a username:
$ git config --global user.email "example@email.com"

Confirm:

$ git config --global user.email
> example@email.com

Repository (repo) setup

To create a repository (repo) for the current working folder (assuming you have created and entered into it already):

$ git init

Remote repo setup

To connect the (already-created) remote version of our local repo:

$ git remote add [remotename] [repoURL]

Replace:

Removing the remote repository

For whatever reason, we can also delete the remote with this command from the local working folder:

$ git remote remove [remotename]
⬅️ older (in textbook-git)
🐙 Git essentials
newer (in textbook-git) ➡️
Git command aliasing 🐙
⬅️ older (in code)
🐙 Git essentials
newer (in code) ➡️
TypeScript overview 🟦
⬅️ older (posts)
🐙 Git essentials
newer (posts) ➡️
Samizdat 📜