Capstone: Kusina, for real · lesson 1 of 6
Commands and ideas in this lesson
Agit --version1.3: check Git is installed
Bgit init --barea shared repository with no working folder
Cgit clone4.5: your own copy
Dgit config (no --global)settings for one repository only

Set up

Last updated

The capstone leaves the sandbox. Over six lessons you'll build Kusina for real, on your own computer: Lola Remy's notebook typed up, two cousins working on it at once, a release, three things going wrong, and finally a contribution to someone else's project. You'll play both Ana and Carla, from two folders. This lesson sets that up.

By the end of this lesson you can

  • Install and configure Git on your own computer
  • Create a shared repository on a hosting site, or as a bare repository on your computer
  • Clone it twice, and give each clone its own name with per-repository config

What you'll build

The capstone, lesson by lesson
LessonYou willUses
C.1 Set upMake a shared Kusina and two clones, one for Ana and one for Carla1.3, 4.5, 4.8
C.2 Lola Remy’s notebookCommit twenty recipes as Ana, with a .gitignore and a READMEStage 1
C.3 Two cooksWork as both cousins at once on branches; resolve three conflicts; review pull requestsStages 3 and 4
C.4 Tidy and releaseTidy a branch with interactive rebase, use Conventional Commits, tag v1.0Stage 6, 7.2, 3.6
C.5 Things go wrongFind a broken recipe with bisect, rescue a deleted branch, respond to a committed secret2.7, 7.6, 8.4
C.6 Your first contributionContribute to a project that isn’t yours5.5

Every command is one you've used in the sandbox. The difference is that now it's real: real files, a real editor, and a real terminal that won't stop you doing something drastic. Lessons 2.7 and 8.3 are your safety net.

Each lesson ends with a check: commands to run, and what you should see. Your hashes and dates will differ from the samples; the shape should match.

Check your Git

If you set Git up in lesson 1.3, check it's still there:

Terminal
git --version
git version 2.55.0
git config --global user.name
Ana Reyes
git config --global init.defaultBranch
main

Any recent version is fine. If git isn't found, install it from git-scm.com/downloads, then set your name, email and init.defaultBranch as in lesson 1.3. Your global name is used for Ana; you'll give Carla hers in step 4.

Make the shared repository

Ana and Carla need one repository they both push to. Choose one way:

On a hosting site (13 and over, with an account): create an empty repository called kusina on GitHub, GitLab or Codeberg, without a README or licence, following the host's own guide (sources below). Set up an SSH key or credential manager as the host describes (lesson 4.8). Copy its address.

On your own computer (no account needed): a bare repository is a repository with no working folder, just what's normally inside .git. It's what a hosting site keeps on its server, and you can push to it like one:

Terminal
cd ~
git init --bare kusina-shared.git
Initialized empty Git repository in /home/ana/kusina-shared.git/

Its address is its path: ~/kusina-shared.git (on Windows, something like C:/Users/you/kusina-shared.git). You'll miss pull requests, which are a hosting feature, but C.3 shows how to do the same review by hand.

Two clones, two cooks

Clone it twice, into two folders, from your home folder. Use your own address:

Terminal
git clone ~/kusina-shared.git ana-kusina
Cloning into 'ana-kusina'...
warning: You appear to have cloned an empty repository.
done.
git clone ~/kusina-shared.git carla-kusina
Cloning into 'carla-kusina'...
warning: You appear to have cloned an empty repository.
done.

Now give Carla's folder Carla's name. Without --global, git config writes to that one repository's .git/config, which wins over your global settings there:

Terminal
cd ~/carla-kusina
git config user.name "Carla Reyes"
git config user.email "[email protected]"
git config user.name
Carla Reyes
cd ~/ana-kusina
git config user.name
Ana Reyes

From now on, which cousin you are depends on which folder you're in. Keep two terminal windows open, one for each, and check the prompt before committing.

Check your setup

In each folder, run these. You should see the shared address, and the right name in each:

Terminal
cd ~/carla-kusina
git remote -v
origin	/home/ana/kusina-shared.git (fetch)
origin	/home/ana/kusina-shared.git (push)
git config user.name
Carla Reyes
git status
On branch main

No commits yet

nothing to commit (create/copy files and use "git add" to track)
In carla-kusina you ran git config user.name "Carla Reyes" without --global. Where does it apply?
What is a bare repository?

Sources

Every command on this page behaves as these pages describe, and the sandbox prints what Git 2.55 prints. Hosting features (pull requests, protected branches) come from the host’s own documentation.

All sources for Simple Git