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
| Lesson | You will | Uses |
|---|---|---|
| C.1 Set up | Make a shared Kusina and two clones, one for Ana and one for Carla | 1.3, 4.5, 4.8 |
| C.2 Lola Remy’s notebook | Commit twenty recipes as Ana, with a .gitignore and a README | Stage 1 |
| C.3 Two cooks | Work as both cousins at once on branches; resolve three conflicts; review pull requests | Stages 3 and 4 |
| C.4 Tidy and release | Tidy a branch with interactive rebase, use Conventional Commits, tag v1.0 | Stage 6, 7.2, 3.6 |
| C.5 Things go wrong | Find a broken recipe with bisect, rescue a deleted branch, respond to a committed secret | 2.7, 7.6, 8.4 |
| C.6 Your first contribution | Contribute to a project that isn’t yours | 5.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:
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:
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:
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:
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:
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)
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.
- Git downloads: installers for every system
- Pro Git: First-Time Git Setup: global and per-repository settings
- Git documentation: git-init, --bare: a repository with no working folder
- Git documentation: git-config: --global and the repository's own settings
- GitHub Docs: Creating a new repository
- Codeberg: Your first repository: the same on a non-profit host