Skip to content

justintanner/ra-101

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation

Rails Academy: Lesson 101 - Command Line Essentials

This lesson covers the basic command line tricks we'll need to do lessons on Rails Academy.

If you don't understand all the commands, don't worry! We'll be using them a lot in the future, so you'll get plenty of practice.

Topics

  • Bash
  • GitHub
  • SSH Keys
  • GitHub CLI (gh)

Prerequisites

Install Rails Academy

1. Sign Up for GitHub

Visit GitHub and create a free account or log in if you already have one.

2. Generate a local SSH Key

Open Alacritty and run the following command:

ssh-keygen -t ed25519
  • Press Enter multiple times to accept to all the defaults
  • Do not enter a passphrase when prompted

3. Copy your SSH Key

macOS

pbcopy < ~/.ssh/id_ed25519.pub

Ubuntu and Windows

cat ~/.ssh/id_ed25519.pub

Copy the text that is outputted.

4. Add your SSH Key to GitHub

  • In GitHub, navigate to Settings > SSH and GPG keys > New SSH Key
  • Paste your public key into the “Key” field
  • Select a title for the key like "Rails Academy Key"
  • Click "Add SSH Key"

5. Test that GitHub is connected

Expected output:

Hi yourgithubusername! You've successfully authenticated, but GitHub does not provide shell access.

6. Create a Branch

First, let's make sure we are in the right folder.

cd ~/lessons/ra-101

Then we'll need to:

  • Visit Skool and copy your “Skool ID” from your profile
  • Create a branch with your Skool username with the command below:
git branch @my-skool-username
git checkout @my-skool-username

Your terminal prompt should now show:

~/lessons/ra-101 [@my-skool-username]
$ _

This means git is currently on the @skool-username branch.

7. Add a File to Git

echo "@my-skool-username" > skool.txt
git add skool.txt
git commit -m "Added skool.txt with my Skool ID"

Lets double check the log, to make sure the commit was successful:

git log

Your should see something like:

commit 1234567890abcdef1234567890abcdef12345678 (HEAD -> @my-skool-username)
Author: yourgithubusername <yourgithubemail>
Date:   Mon Jan 1 00:00:00 2021 -0500

    Added skool.txt with my Skool ID

8. Create a Pull Request

  • Authenticate with GitHub CLI:
gh auth login
  • Select GitHub.com > HTTPS > Login with web browser.
  • Create the PR:
gh pr create
  • Press Enter multiple times to accept the defaults
  • Select Submit
  • You should get a link to your PR, it should look like this:
https://github.com/yourusername/ra-101/pull/1
  • Visit your PR on Github.

The automatic check will run if your code passes, you'll see:

✅ All checks have passed

🎉 You're Done! 🎉

Next Lesson

Once accepted its time to move onto the next lesson.

Additional Resources